ANDROID_ID の Android 8.0 における仕様変更

ANDROID_ID が Android 8.0(Oreo: API-26)において仕様変更されたようだ。このため、従来のように ANDROID_ID がデバイス固有の ID と思って扱っていると、意図しない結果につながる。

Android ID

In O, Android ID (Settings.Secure.ANDROID_ID or SSAID) has a different value for each app and each user on the device. Developers requiring a device-scoped identifier, should instead use a resettable identifier, such as Advertising ID, giving users more control. Advertising ID also provides a user-facing setting to limit ad tracking.

Additionally in Android O:

  • The ANDROID_ID value won't change on package uninstall/reinstall, as long as the package name and signing key are the same. Apps can rely on this value to maintain state across reinstalls.
  • If an app was installed on a device running an earlier version of Android, the Android ID remains the same when the device is updated to Android O, unless the app is uninstalled and reinstalled.
  • The Android ID value only changes if the device is factory reset or if the signing key rotates between uninstall and reinstall events.
  • This change is only required for device manufacturers shipping with Google Play services and Advertising ID. Other device manufacturers may provide an alternative resettable ID or continue to provide ANDROID ID.
Changes to Device Identifiers in Android O (10 April 2017)

基本的に ANDROID_ID の値はデバイス固有ではなくなり、アプリ毎に提示される ANDROID_ID が異なる。さらに、同じアプリであっても、APK にされたサインが異なると別アプリの扱いとなるので、debug ビルドと release ビルドとでは別アプリの扱いとなり、提示される ANDROID_ID が異なることとなる。

自分の場合、開発者モードを識別するために予め登録した ANDROID_ID(を基に算出した Admob ID)に基いてテストデバイスを識別していたが、なぜか意図通りに認識されないので悩んでいたが、こういうことだった。

GooglePlay には、Admob ID を表示できるアプリなどがあり、最近のレビューではちゃんと表示されないという文句が多く見られたが、それもこれが原因だろう。Android 8 以降かそれ以前かで挙動が異なるわけである。

コメント

このブログの人気の投稿

清水俊史『上座部仏教における聖典論の研究』

シークエンスパパともの先見の明

シークエンスパパとも 本物の霊能力