![](/img/trans.png)
[英]How to add button to Google Play store in bottom corner of Android App?
[英]android - Update button is not displaying on Google Play Store
我的Android应用程序中有一个强制更新,它会在Play商店中检查我的应用的版本名称,并通过我的应用更新进行验证。 如果Google Play商店的版本与当前版本不同,则会显示一条用于更新的弹出消息。
当用户按下弹出窗口上的更新按钮时,它将重定向到Play商店。 问题是,在Google Play商店的某些设备上,未显示“更新”按钮,而显示了“打开”按钮。
我尝试清除缓存,并且它起作用了。 但这对用户来说不是很方便。 在多少设备上,我必须继续这样做。
这是我的以下代码,用于验证应用版本:
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 "";
}
}
这是用于重定向到Google Play商店的代码:
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商店缓存。
可能需要什么解决方案?
提前致谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.