其他分享
首页 > 其他分享> > Android O中的Android_ID

Android O中的Android_ID

作者:互联网

我们使用以下代码获取唯一的ID:

String id = Settings.Secure.getString(mContext.getContentResolver(),
                 Settings.Secure.ANDROID_ID);

在Android O更改指南中,我们可以看到以下几点:

Android O对平台进行了以下与隐私相关的更改.
https://developer.android.com/preview/behavior-changes.html

The platform now handles identifiers differently.
Values of ANDROID_ID are now scoped per-app instead of per-user. The value of ANDROID_ID is unique for each combination of application package name, signature, user, and device. Two apps running on the same device no longer see the same Android ID, and so cannot correlate.

The value of ANDROID_ID does not change on package uninstall or reinstall, as long as the package name and signing key are the same.

The value of ANDROID_ID does not change if the package signing key changes due to an update.

For apps that were installed prior to the OTA, the value of ANDROID_ID remains the same unless uninstalled and then reinstalled.

If you wish to continue using Android ID for device-bound free trial protection, you can do so. Make sure that the package name and signature match.

For a simple, standard system to monetize apps, use Advertising ID. Advertising ID is a unique, user-resettable ID for advertising, provided by Google Play services.

我对以上内容的理解是,现在前进的Android_ID将是应用程序绑定而不是设备绑定.但是我对以下几点感到困惑:

对于在OTA之前安装的应用程序,除非卸载然后重新安装,否则ANDROID_ID的值保持不变.
如果您希望继续使用Android ID进行设备绑定的免费试用保护,则可以这样做.确保程序包名称和签名匹配.

1)这是什么意思?除非重新安装我的应用程序,否则即使我们发送更新,它仍将继续具有旧版android_id.

2)如果您希望继续使用Android ID进行设备绑定的免费试用保护,则可以这样做.确保软件包名称和签名匹配.:这是什么意思?

解决方法:

1)假设您的应用安装在N设备上时,其ID为abc.现在,当设备更新为O时,返回给您的设备ID将继续为abc.但是,如果用户在升级到O后卸载并重新安装该应用程序,则ANDROID_ID将更改为其他值.

另一方面,如果该应用程序已安装在O设备上,然后又被卸载并重新安装,则ANDROID_ID将保持不变.

2)这意味着只要包名称和签名保持相同,ANDROID_ID的值就将保持相同.如果您的应用在O设备上进行了更新并且签名发生了变化,那么它也将保持不变.

本质上,android现在将使用包名称/签名在O上生成唯一标识符.

标签:android-identifiers,android,android-8-0-oreo
来源: https://codeday.me/bug/20191026/1933279.html