如何强制用户更新应用程序? [英] How to force user to update the app?

查看:60
本文介绍了如何强制用户更新应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Playstore 上有一个购物应用.
用户必须拥有许多新更新.
新的 Apk 需要所有用户更新.

I have a shopping app on playstore.
There are many new updates which the user must have.
The new Apk needs to be update by all users.

如何强制所有用户更新他们的应用?

How can I force all my users to update their app?

推荐答案

嗯,您可以通过以下方法做到这一点.

Hmm you can do this by below approach.

  1. 将应用的更新代码版本添加到服务器
  2. 制作一个返回您放置的版本代码的网络服务服务器

如果你有 BaseActivity 做第三个,否则做第一个 Activity 或启动器 Activity 的第三步

  1. onResume 方法中点击该服务并获取应用版本代码并将该代码与当前应用代码匹配.如果两者相同,则可以,否则提示用户并通过终止应用程序将用户带出应用程序.NTOE:您可以使用以下代码获取设备中安装的应用程序的当前版本.

  1. In onResume method hit that service and get App version code and match that code with current app code. If both are same then it is ok else Prompt the user and take the user out of the app by killing the app. NTOE: You can use below code to get the current version of the app that is installed in your device.

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

希望能帮到你.

这篇关于如何强制用户更新应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆