Settings.Secure.ANDROID_ID different in build APK and Signed APK why?

Viewed 778
String androidId = Settings.Secure.getString(getContentResolver(),
                     Settings.Secure.ANDROID_ID);

I'm using this to take android id. Doubt is ANDROID_ID how could be different for signed apk and build apk of same device? I need unique identity of my device. If ANDROID_ID is changed then is it good to use this?

1 Answers

Android 8.0+ randomizes the ANDROID_ID value:

For apps installed on a device running Android 8.0, the value of ANDROID_ID is now scoped per app signing key, as well as per user. The value of ANDROID_ID is unique for each combination of app-signing key, user, and device. As a result, apps with different signing keys running on the same device no longer see the same Android ID (even for the same user).

The documentation has an extensive guide on unique identifiers. Also, be sure to discuss your plans with an attorney.

Related