How to programmatically check the version of an application in a play store?

I have an application in the game store and I would like to do the following:

When the user launches the application, he must check whether the version of the application that is in the playback store is installed, and if NOT, I show a dialog to prevent this situation with the possibility of redirecting to playback in the store in order to update it.

I know that the play store application does this automatically, but if the user changes this configuration .. this is a problem!

A tried to find a solution over the Internet, but to no avail, any help ??: D

+4
source share
2 answers

There is no official way to do this. However you can take a look at

https://code.google.com/p/android-market-api/ .

You can search the market using the name of your package and then extract the version number from it. Follow the example here .

A better / simpler solution is to place the XML file (or even the .txt file) online and save the current version in it. then check it when you start the application.

+8
source

Please use the JSoup fr library that gets the version from the game store.

String newVersion = Jsoup .connect( "https://play.google.com/store/apps/details?id=" + "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[itemprop=softwareVersion]").first() .ownText(); Log.e("new Version", newVersion); 
+3
source

All Articles