简体   繁体   English

我可以在Google Play上从我的应用页面下载的.apk的每个副本上附加一个唯一的ID吗?

[英]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.). 我们正在为应用的每个副本搜索具有唯一ID(用于注册等)的方法。 Using device identifiers (MAC, phone number, IMEI) is not an option, as we need to provide this id from our side. 使用设备标识符(MAC,电话号码,IMEI)不是一种选择,因为我们需要从我们这边提供此ID。 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)? 如果没有,另一个问题是,是否有可能知道.apk的来源(例如,我们能否说明从Google Play和亚马逊商店下载的相同.apk之间的差异)?

Yes, you can tell the difference between the same .apk downloaded from Google Play and from Amazon Store 是的,您可以区分从Google Play和亚马逊商店下载的相同.apk

Use PackageManager.getInstallerPackageName() to get the package name of application which installed the the application. 使用PackageManager.getInstallerPackageName()获取安装该应用程序的应用程序的包名称。 The value is com.android.vending if the app was installed from Google Play. 如果应用程序是从Google Play安装的,则值为com.android.vending

eg: 例如:

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

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. 看看这个, https://developers.google.com/analytics/devguides/collection/android/v2/campaigns#google-play-how这里你可以传递一个参数,让你识别该应用程序是从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 然后你可以在服务器上生成unique_id并在第一次启动服务器时调用并将其存储在你的应用程序中,或者只是在开始时生成一个唯一的数字(以毫秒为单位的时间戳+随机)并保存此应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM