How to detect the current release track inside the android app?(Google Play Console)

382 Views Asked by At

I am planning to release my app to beta track before the prod. But I would like to enable in-app-bug reporting only for the beta users. Instead of creating two APKs(enabled in prod beta & disabled in prod), can I know programmatically from which track user has installed the app, is there any API available for that?

what I want to achieve is,

if(app installed from beta track)
  enable in-app-bug reporting
else 
  disable in-app-bug reporting
2

There are 2 best solutions below

1
Lena Bru On
buildTypes {

    debug {
        buildConfigField "Boolean", "in_app_bug", true
    }

    staging {
        buildConfigField "Boolean", "in_app_bug", true
    }

    release {
        buildConfigField "Boolean", "in_app_bug", false
    }
}

then in the code:

if(BuildConfig.in_app_bug) {
  ....
}

The same can be done for buildFlavors

0
Christian Z. On

According to the documentation:

The release name is only for use in Play Console and won't be visible to users.