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

前端 未结 4 1811
暗喜
暗喜 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:53

    Get the versionnumber and versioncode from manifest programatically like:

    String versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
    

    or

    int versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
    

    Strore them in your app by shared preference.Now whenever the user open the app check the current versionCode with the previous one.If they match,then let the user to use the app.But if they dont match then show a pop up to ask the user to update your app.

提交回复
热议问题