问题描述
我在Play商店中有我的应用.当有新版本可用时,我想强制更新用户.为此,我想比较当前安装的应用程序版本和应用程序启动时Play商店的版本.在xamarin中查找版本并强制更新但是我没有在响应中得到任何//div [@ itemprop ='softwareVersion']标签.因此,我没有从Play商店获取版本号.有什么方法可以在Play商店中获取当前版本.
I have my app in play store. I want to force update the user when a new version is available. To achieve this I want to compare the current installed app version and the version of the play store when the app launches.Looking up version and forcing an update in xamarinBut I am not getting any //div[@itemprop='softwareVersion'] tag in the response . Hence I am not getting the version number from play store. Is there any working way to get the current version in play store.
推荐答案
希望Google不会更改用于显示应用详细信息的当前格式,这是您必须对代码进行更改以获取当前版本的更改:
Hoping that Google won't change the current format for displaying the details of the app, here's the change you have to apply on your code to get the current version:
@Override
protected JSONObject doInBackground(String... params) {
try {
latestVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + context.getPackageName() + "&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:containsOwn(Current Version)").next().text();
} catch (IOException e) {
e.printStackTrace();
}
return new JSONObject();
}
这篇关于如何获取Xamarin Android的Play商店版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!