Android_ID in Android O

We use the below code to get the unique id:

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

      

In the Android O change guide, we can see the following points:

Android O makes the following privacy changes on the platform. 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.

      

My understanding of the above is that now Android_ID will be app-bound instead of device-bound. However, I am confused below:

For apps that were installed prior to OTA, the ANDROID_ID value remains unchanged unless uninstalled and then reinstalled. If you would like to continue using Android ID for a free trial of device-related protection, you can do so. Make sure the package name and signature match.

1) What does this mean? If my app is not reinstalled will it continue to work with the outdated android_id even if we send an update?

2) If you would like to continue using Android ID for free trial protection associated with the device, you can do so. Make sure the package name and signature match: What does this mean?

+3


source to share


2 answers


1) Imagine your app has an ID abc

if it is installed on device N. Now when the device is updated to O, the device ID returned to you will remain abc

. However, if the user uninstalls and reconfigures the app update after to O ANDROID_ID

will change to a different value.

On the other hand, if the app was installed on device O and then uninstalled and reinstalled, it ANDROID_ID

will remain the same .



2) This means that as long as the package name and signature remain unchanged, the value ANDROID_ID

will remain unchanged. It will also remain the same if your app is updated on device O and the signature changes.

Essentially, android will now use the package name / signature to generate a unique identifier in O.

+3


source


There are no explicit ANDROID_ID values ​​in Android documentation for apps with different package names, but with a common user ID and signed with the same key. Benchmarks on Nexus 5, Android O Beta 3 show the value of Android ID for two apps, also in this case.



0


source







All Articles