We use beta staging in google play store. For app side force update functionality we want to detect if our app is either coming from the beta stage or the production stage o
You can do this with the Google Play Developer API but it looks pretty painful.
https://developers.google.com/android-publisher/edits/overview
https://github.com/googlesamples/android-play-publisher-api/blob/master/v2/java/src/com/google/play/developerapi/samples/ListApks.java