2

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.

Sharpevil
  • 194
  • 5
  • 18

1 Answers1

1

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.

Community
  • 1
  • 1
Ab5
  • 606
  • 9
  • 25
  • I'm fairly sure, though, that if it was as simple as checking the installationSource string, piracy of android apps would be far more difficult, as the apps could simply not work if that value was null, right? I'm looking into the google analytics, though. It's not important if a pirated version of the app is used offline, I just don't want people linking their pirated app to their accounts. – Sharpevil Feb 17 '14 at 07:53
  • then how about you using your payment method to identify such users? for ex. if you are accepting payment through Google wallet, you can identify which users are paying for the app only those users will be provided with a log in ID, others will have use a guest login. – Ab5 Feb 17 '14 at 08:44
  • That seems like what I would want, assuming it's compatible with existing accounts. I'll look into that. – Sharpevil Feb 17 '14 at 09:35