I am working on an application I want to give force update to app users if new version available on play store, the app should show a dialog message to user.
Store the versionCode of your app(which you have released on the playstore) on the server side. Hit the API every time user opens the app and get the versionCode. Compare the versionCode of the app user is currently using and the one you have stored on the server. Here is the code to get the versionCode of your app
PackageManager manager = this.getPackageManager();
PackageInfo info = manager.getPackageInfo(this.getPackageName(), 0);
String versionCode = info.versionCode;
If the versionCode doesn't match(i.e versionCode from server > app's versionCode), prompt the user to update.
P.S If you want to use this method, you have to update versionCode on your server every time you update the app on the playstore.