Alex Timonin
Alex Timonin

Reputation: 1998

Can I attach a unique ID to every copy of the .apk downloaded from my app's page on Google Play?

We are searching for a way for every copy of the app to have a unique id (used for registration etc.). Using device identifiers (MAC, phone number, IMEI) is not an option, as we need to provide this id from our side. Is there a way to do this? If not, another question would be if it's possible to know where the .apk was gotten from (for instance, can we tell a difference between the same .apk downloaded from Google Play and from Amazon Store)?

Upvotes: 0

Views: 1337

Answers (2)

A.S.
A.S.

Reputation: 4574

Have a look at this, https://developers.google.com/analytics/devguides/collection/android/v2/campaigns#google-play-how here you can pass a parameter which let u identify that the app was downloaded from gplay. Then you could generate the unique_id on a server and make a call on first start to the server and store it in your app, or just generate a unique number (timestamp in millis + random) at the start and save this app

Upvotes: 1

Infinite Recursion
Infinite Recursion

Reputation: 6557

Yes, you can tell the difference between the same .apk downloaded from Google Play and from Amazon Store

Use PackageManager.getInstallerPackageName() to get the package name of application which installed the the application. The value is com.android.vending if the app was installed from Google Play.

e.g:

getPackageManager().getInstallerPackageName(getPackageName()).equals("com.android.vending")

Upvotes: 1

Related Questions