Sharpevil
Sharpevil

Reputation: 194

Can I verify that a user has a legitimate copy of an android app for online features?

I'm looking into building a game for android devices that players can log in on with their accounts from a website I host. I want the app to connect to update the player's account with information from the game, such as their high score. Is it possible to verify that the game was purchased, and if it was not, prevent the app from logging the data to the user's account? I don't mind so much if people pirate the game and play it unconnected, but I want to have the account benefits only for legitimate purchases. The game will be made in Unity3D, but I doubt that particularly matters.

If this is possible, some links in the right direction of where to look for info would also be appreciated.

Upvotes: 2

Views: 991

Answers (1)

Ab5
Ab5

Reputation: 606

I am assuming that by legitimate copy you mean it was installed from the play store . If so then you can use :

PackageManager pm = getPackageManager();
String installationSource = pm.getInstallerPackageName(getPackageName());

'installationSource' will contain the package name if it was installed from play store and will be null if not.

Another way is by using google analytics as mentioned here.

Upvotes: 1

Related Questions