java - android - Google Play 商店上未显示更新按钮
问题描述
我在我的 android 应用程序中进行了强制更新,它会在 Play 商店中检查我的应用程序的版本名称,并通过我的应用程序更新进行验证。如果 google play 商店版本与当前版本不同,它会显示更新的弹出消息。
当用户按下弹出窗口上的更新按钮时,它会重定向到 Play 商店。问题是,在 google play store 上,在某些设备中,“更新”按钮不显示,而显示“打开”按钮。
我尝试清除缓存,它工作。但是用户这样做不是很方便。在多少设备上,我必须继续这样做。
这是我下面的代码,用于验证应用程序版本:
protected String doInBackground(String... urls) {
try {
newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + <Your package name> + "&hl=en")
.timeout(30000)
.userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
.referrer("http://www.google.com")
.get()
.select("div.hAyfc:nth-child(4) > span:nth-child(2) > div:nth-child(1) > span:nth-child(1)")
.first()
.ownText();
return newVersion;
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
这是重定向到谷歌游戏商店的代码:
try {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(Uri.parse("market://details?id=" + context.getPackageName()));
startActivity(intent);
dialog.dismiss();
} catch (Exception e) {
e.printStackTrace();
}
正如我已经告诉过你的那样,在某些设备中它工作正常,而在某些设备中,我必须清除 Google Play 商店的缓存。
什么是理想的解决方案?
提前致谢。
解决方案
推荐阅读
- php - GuzzleHttp POST 请求数据意外更改
- r - 执行使用空间点提取时间序列值的函数时出现错误消息
- python - 打开和关闭我用python从树莓派构建的pdf文件
- angular - 重置所有多选下拉菜单
- ios - 为什么数组中的块类型不同?
- javascript - iOS WKWebView 不像以前的 WebView 那样支持 windowScriptObject
- php - Symfony 4 - 避免更新数据库上未给定的字段
- vba - 进入另一种形式之前的延迟时间
- ios - rxswift observable 的简单 swift 变量
- node.js - 如何使任务调度程序可以访问环境变量?