Force app to update when new version of app is available in android play store

前端 未结 4 1804
暗喜
暗喜 2020-12-10 15:36

I had an app on the playstore. Know what I want is when new update is available on playstore the user should get a popup to update the app when he try to use the app. And if

4条回答
  •  眼角桃花
    2020-12-10 15:55

    I just wrote a class that helps you to know when there is a new version of your app published on Google Play Store.

    With the class, you will be able to implement something really simple like this:

    new CheckNewAppVersion(yourContext).setOnTaskCompleteListener(new CheckNewAppVersion.ITaskComplete() {
        @Override
        public void onTaskComplete(CheckNewAppVersion.Result result) {
    
            //Checks if there is a new version available on Google PlayStore.
            result.hasNewVersion();
    
            //Get the new published version code of the app.
            result.getNewVersionCode();
    
            //Get the app current version code.
            result.getOldVersionCode();
    
            //Opens the Google Play Store on your app page to do the update.
            result.openUpdateLink();
        }
    }).execute();
    

    You can download the class here and use in your project. Basically, you use Jsoup lib to get o actual version published by making a request to Google Play Store page.

提交回复
热议问题