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
Assuming the same apk is typically promoted from Beta to Production, the answer by Dizzy suggesting that a call out to some external API is required is the way to go.
However, rather than setting up and hitting your own back-end API, you can just use an android HttpURLConnnection to check the Google Play store details page for your own app id.
If the current user is enrolled in Beta, the app name is presented as "App Name (Beta)".
A little further down the page it will also say "You're a beta tester for this app. Awesome!"
The page contains a single button labelled either "Install", "Update" or "Installed", from which you can determine whether or not the user has the latest version
On the same page your app can also look up the last production Updated date, and latest production version name.
Sample Java code for how you might implement this below:
boolean isBeta = false;
URL url = new URL("https://play.google.com/sore/apps/details?id=com.example.app");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
Scanner scanner = new Scanner(in);
isBeta = (scanner.findWithinHorizon("\\s\\(Beta\\)", 650000) != null);
} finally {
urlConnection.disconnect();
}