Home » Android » android – Determine environment Google Play (production, beta, alpha)

android – Determine environment Google Play (production, beta, alpha)

Posted by: admin May 14, 2020 Leave a comment

Questions:

Is it possible for the app to determine in what environment of Google Play the app is released?

I want to know if the app is located in the alpha, beta or production channel so i can use different API urls for each of the environments, like so:

  • alpha – test.example.com/api/login

  • beta – staging.example.com/api/login

  • production – example.com/api/login

Right now i have to upload many different APK’s and increment the versionCode to use the 3 different channels. So is it possible to determine the channel it was uploaded to?

How to&Answers:

I see two options here. You can :

  • add an in-app runtime mechanism to change environment. By default the app
    would use production env but you can change it using a hidden/secured
    menu
  • upload a version on google play for each environment. You do some alpha/beta testing using test or staging environment and when everything is ok you promote the production build. Still, you need to think carefully your package names or version codes…

Hope it helps 🙂

Answer:

You can’t, as far as I know. Besides if it was installed from beta you could later make that as the normal release anyways – so it’s not the install source, but where it is currently that matters. What you’re doing is not alpha/beta testing in the sense that it’s in the play store.

But you could guess if it’s the public version by checking from the store listing if the version number is greater than that.

Is it possible to detect that an android app is either a beta version or production version? has some links into a google developer api to do basically just that(though I’m pretty sure you could just scrape it off the web too).

All and all the system isn’t really meant for staging testing in that sense where you would have them connect to a different environment, so you might just be better off planning your testing again. It’s more suited for actual beta testing before committing to updating all users of the application.

What could be an option for you then would be to create entirely different private products for each of the different servers/tracts you have (you’ll need to change the app id though for those builds, but that might be for the better).

edit: you can greatly simplify my first suggested solution/hack if you make the compromise of having the latest versions name be served from your own server, so you can check if your version number is greater than that then connect to beta,alpha or whatever api. This will complicate making the actual release as you need to remember to change this, however it would allow you to test the beta version on the actual production server too then before promoting it to the full release status.