How can I get the application version information from google play store for prompting the user for force/recommended an update of the application when play store application is updated i.e. in case of the user is using old version application. I have already gone through andorid-market-api which is not the official way and also requires oauth login authentication from google. I have also gone through android query which provides in-app version check, but it is not working in my case. I found the following two alternatives:
- Use server API which will store version info
- Use google tags and access it in-app, which is not a preferred way to go.
Are there any other ways to do it easily?
You can call the following WebService: http://carreto.pt/tools/android-store-version/?package=[YOUR_APP_PACKAGE_NAME]
Example Using Volley:
I will recommend to use ex. push notification to notify your app that there is a new update, OR use your own server to enable your app read version from there.
Yes its additional work each time you update your app, but in this case your are not depended on some "unofficial" or third party things that may run out of service.
Just in case you missed something - previous discussion of your topic query the google play store for the version of an app?
I recomned dont use a library just create a new class
1.
In your activity:
THAT IS ALL
Apart from using JSoup, we can alternatively do pattern matching for getting the app version from playStore.
To match the latest pattern from google playstore ie
<div class="BgcNfc">Current Version</div><span class="htlgb"><div><span class="htlgb">X.X.X</span></div>
we first have to match the above node sequence and then from above sequence get the version value. Below is the code snippet for same:I got this solved through this. This also solves the latest changes done by Google in PlayStore. Hope that helps.
Use server API which will store version info
Like you said.This is an easy way to detect an update. Pass your version info with every API calls. When playstore is updated change the version in server. Once the server version is higher than installed app version, you can return a status code/message in API response which can be handled and update message can be showed. You can also block users from using very old app like WhatsApp do if u use this method.
Or you can use push notification, which is easy to do...Also
Use this code its perfectly working fine.