Force update of an Android app when a new version is available

android programmatically update application when a new version is available
force update android app github
how to notify users about an android app update
force your users to update your app with using firebase
how to test in-app update android
google play console force update
ionic force update app
how to make android app force update

I have an app in Google Play Store. When an update version is available, the older version will become unusable – that is, if users do not update the app, they do not enter in the app. How can I force users to update the app when a new version becomes available?


How to force update in Android application if new version is available?, to force their users to update their apps when they launch new features the company is actually making this feature available to developers. For forcing the app user to update if an update is available in the market, you should first check the app version on the market and compare it with the version of the app on the device. If they are different, it may be an update available.


try this: First you need to make a request call to the playstore link, fetch current version from there and then compare it with your current version.

String currentVersion, latestVersion;
Dialog dialog;
private void getCurrentVersion(){
 PackageManager pm = this.getPackageManager();
        PackageInfo pInfo = null;

        try {
            pInfo =  pm.getPackageInfo(this.getPackageName(),0);

        } catch (PackageManager.NameNotFoundException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        currentVersion = pInfo.versionName;

   new GetLatestVersion().execute();

}

private class GetLatestVersion extends AsyncTask<String, String, JSONObject> {

        private ProgressDialog progressDialog;

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
        }

        @Override
        protected JSONObject doInBackground(String... params) {
            try {
//It retrieves the latest version by scraping the content of current version from play store at runtime
                Document doc = Jsoup.connect(urlOfAppFromPlayStore).get();
                latestVersion = doc.getElementsByClass("htlgb").get(6).text();

            }catch (Exception e){
                e.printStackTrace();

            }

            return new JSONObject();
        }

        @Override
        protected void onPostExecute(JSONObject jsonObject) {
            if(latestVersion!=null) {
                if (!currentVersion.equalsIgnoreCase(latestVersion)){
                   if(!isFinishing()){ //This would help to prevent Error : BinderProxy@45d459c0 is not valid; is your activity running? error
                    showUpdateDialog();
                    }
                }
            }
            else
                background.start();
            super.onPostExecute(jsonObject);
        }
    }

private void showUpdateDialog(){
        final AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("A New Update is Available");
        builder.setPositiveButton("Update", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse
                        ("market://details?id=yourAppPackageName")));
                dialog.dismiss();
            }
        });

        builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                background.start();
            }
        });

        builder.setCancelable(false);
        dialog = builder.show();
    }

Support in-app updates, apps from the app stores and update them if there is a new version. I suggest you to use bundled Firebase plug-in of Android Studio 2.2. Launch the Play Store, slide out the menu and tap on Settings. From there, scroll to the very bottom of the list where you will find a "Build Number" entry - tap on it. If an update is available,


You shouldn't stop supporting an older version as soon as a new version comes out. This will result in a terrible user experience. I don't know of any software vendor in existence that does this, for good reason.

What happens if the user can't update or doesn't want to at that time? They simply can't use your app, which is bad.

Google don't provide any option for version tracking like that so you would have to roll your own. A simple web service to return the current live version that your app can check would be sufficient. You can then update the version and the app will know it is outdated. I would only recommend using this to let your users know there is an update more quickly than depending on Google Play. It should not really be used to prevent the app from working, just to prompt the user to update.

Android developers can now force app updates, You can either update the apps downloaded and installed on your Android device individually or The app will update automatically when updates are available. To turn Note: Some apps require new permissions when they are updated. When you upload a new version of your app, it will either send an alert directly to your users' devices or download the upgrade automatically if the user has this option turned on in the Google Play app.


Solution from Google team

Starting from Android 5.0 that's easily achievable through the new Google Play In App updates mechanism. The requirements are to have Play Core library of version 1.5.0+ and use App Bundles idstribution instead of apks.

The library provides you 2 different ways to notify the users about the update:

  1. Flexible, when users can continue using the app while it is being updated in the background.

  2. Immediate - blocking screen that doesn't allow a user to enter the app until they update it.

There are next steps to implement it:

  1. Check for update availability
  2. Start an update
  3. Get a callback for update status
  4. Handle the update

All of these steps implementations are described in details on the official site: https://developer.android.com/guide/app-bundle/in-app-updates

Force your users to update your app with using Firebase, The new feature will make apps safer to use. This tool will help devs keep their apps safe by ensuring older versions aren't used if there's a  Open the Play Store app > open main menu > My apps & games > and there you should see that your app has a new update. If you don't see it make sure that your new update is already released on the track (go to your bookmarked page and use it to open your apps listing on the Play Store to see what version is shown there).


Scott and Michael's answers are correct. Host a service that provides a min version number you support and compare that to the installed version. You should hopefully never need to use this, but it's a life saver if some version is out there you absolutely must kill due to some serious flaw.

I just wanted to add the code for what to do next. Here is how you then launch the Google Play Intent and take them to your new version in the store after prompting the user that they must upgrade.

public class UpgradeActivity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_upgrade);
        final String appName = "com.appname";
        Button button = (Button) findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id="+appName)));

            }
        });
    }
}

You should re-consider your design if you have to force upgrades on each release.

Update your Android apps - Google Play Help, Force users to update to the latest version of my app on the Google Play Store · android android-market. Is there a way to have a "critical update" for my app on the  Check that out! Auto-update is turned on and yet there are still 29 apps with updates available. Yeesh. Tap on the green “Update All” button and then find something else to do for a bit; it’s going to take a while! Once these app updates are done, however, you’re good to go and your HTC One is updated!


Android developers can now force you to update your apps, Now, Google actually making this feature available to developers. The new feature: "Inline Updates" allows developers to access new API that they can use to  Most system updates and security patches happen automatically. To check if an update is available: Open your device’s Settings app. Tap Security. Check for an update: To check if a security update is available, tap Security update. To check if a Google Play system update is available, tap Google Play system update. Follow any steps on the screen.


Force users to update to the latest version of my app on the Google , Force the Google Play Store app to update on Android. With a quick tap you can force your Android device to grab the latest version of Google's Play Store. If an update is available, you'll receive a prompt like the one above. Update individual Android apps automatically. To set up updates for individual apps on your device: Open the Google Play Store app . Tap Menu My apps & games. Select the app you want to update. Tap More . Tap Enable auto update. The app will update automatically when updates are available. To turn off automatic updates, uncheck the box. Update


Is it possible to force my android app users of all version to update , Click your profile picture then click Check for Updates. If there is a newer version, Zoom will download and install it. There are 3 types of updates; web-only, mandatory and optional. Web-only updates are available for new fixes that are being tested. Mandatory updates will start once you click on update. You cannot proceed further until you update.