![](/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.