Andro Devlpr
Andro Devlpr

Reputation: 103

how to know user has update the Android app from google play or not

in my android app i want to know that user has updated the app from google play or still using the older version Is there any way to resolve this please let me know

Upvotes: 1

Views: 522

Answers (3)

Bhuppi
Bhuppi

Reputation: 121

First check the current version of the app by using the following code--

PackageManager manager = context.getPackageManager();

PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);

String version = info.versionName;

After getting the the current version either by parsing the play store link or version by hitting your web service you can get the server version of the app. After that you can easily compare version (client version of the app) and the server version(version of app on play store.)

Upvotes: 1

Aritra Roy
Aritra Roy

Reputation: 15615

For this you need to maintain the current version in your own server and query that information from your app time to time.

This is quite trivial to do, if you already own a server. You can keep this information in an xml or json.

If your current app version is less that the version returned by the server, then display a dialog to the user that he/she needs to update and direct the user to the Play Store page of the app.

Upvotes: 0

Amit Vaghela
Amit Vaghela

Reputation: 22945

To Check current version of user you need to know what version user has.

for this ,

send current version as a parameter in webservice and it will return which is the current version.

PackageManager manager = context.getPackageManager();
PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
string version = info.versionName;

checkout this link to get version code

Upvotes: 1

Related Questions