I have an application on play store and i would like to do the following:
When the user starts the application it should verify if the application's version that is on play store is the same that is installed and if NOT i will show a dialog to alert this situation with an option to redirect to play store to update it.
I know that the play store's application do this automatically but if the user change this configuration.. this is a problem!
A tried to find a solution over the internet but without success, any help?? :D
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 your package name and then extract the version number from it, Follow the example here.
A better/simpler solution would be to host a xml file (or even a .txt file) online and store the current version inside it. then check it on your App's startup.
Please use the JSoup library fr getting version from playstore.
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With