I would like to be able to compare, on application start, the running version against the same application's version currently on Google Play.
I found a nice way to this, described here:
public String getLatestVersionNumber() {
String versionNumber = "0.0.0";
try {
Document doc = Jsoup.connect("http://www.appbrain.com/app/wallpaper-switch/com.mlevit.wallpaperswitch").get();
Elements changeLog = doc.select("div.clDesc");
for (Element div : changeLog) {
String divText = div.text();
if (divText.contains("Version")) {
return divText.split(" ")[1];
}
}
}
catch (IOException e) {
e.printStackTrace();
}
return versionNumber;
}
But it's way too slow and significantly hampers user experience on application start.
Is there a faster way to query application's current version on Google Play?
Perhaps some hidden LVL or in-app billing API?