Determine environment Google Play (production, beta, alpha)
Asked Answered
B

2

14

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?

Bask answered 18/4, 2016 at 8:45 Comment(9)
Why do you want to do that. One apk is good enough. First upload to alpha channel, then keep promoting it to beta and production.Cupronickel
Because if i will transfer the alpha APK to beta, the app will still connect to test.example.com/api/login. While i want it to connect to staging.example.com/api/login on betaBask
Got it. I think what you need is product flavors. earh flavor pointing to alpha, staging and production. Here check out my blog post. androiddevsimplified.wordpress.com/2016/04/06/…Cupronickel
And if you want to generate version name and code automatically. androiddevsimplified.wordpress.com/2016/04/16/…Cupronickel
And about your question. Man you have base urls pointing to different urls. you can use that to figure which channel it was uploaded to.Cupronickel
I would say the point is to only have 1 APK and then you can use the promote button to use the same APK but in a different environment. This would be quite useful I think.Perlman
@Perlman Did anyone find a solution here? Being able to determine environment at runtime would be very useful...Basanite
@IsaacHinman Unfortunately not - I have not had the time to play with this, so we have settled on testing debug outside of Google Play, then uploading the live to the Internal Testing track for full smoke test, then when this is passed promoting up the tracks. Still would like to know if this is possible though!Perlman
@IsaacHinman Like deive said, unfortunately not.. We were forced to make some build servers which would build and deploy on the correct channel, so theres less room for human error.Bask
D
2

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 :)

Delores answered 29/1, 2019 at 13:24 Comment(1)
I agree with the first one. We will be doing the method nr.1. In login screen just add [email protected] and the app will work in DEV enviroments. But its sto strange that there isnt a better solution for this provided by google. Nr.2 is sketchy, you could accidentally push DEV build to Live.Conditioned
P
2

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.

Pinnati answered 29/1, 2019 at 16:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.