Is Secure.ANDROID_ID unique for each device?

I am using this call:

Secure.getString(getApplicationContext().getContentResolver(), Secure.ANDROID_ID);

To get a UID for the device. I think I am getting the same ID from multiple devices though. Should this be possible?

  • APN, GCM(FCM): How to add rich media to notifications?
  • ProGuard Cannot Find Referenced Libraries
  • Android listview produces black highlighting over text when scrolling. How to stop this?
  • How to customize individual tabs? (changing background color, indicator color and text color)
  • Camera FLASH_MODE_ON not working on Moto X
  • Android studio suddenly cannot resolve symbol R
  • The ID in question is: 9774d56d682e549c and apparently there is an issue with several devices returning this ID

    Related posts:

    How to keep/exclude a particular package path when using proguard?
    obj Fragment wrong 2nd argument type found '' requ...
    How to implement firebase cloud messaging in server side?
    How to enable horizontal scroll in tab like Google Play?
    Android Proguard, removing all Log statements and merging packages
    Android: Manage contacts with lookup key
  • Android design support library proguard rules
  • What does android:layout_weight mean?
  • Gradle DSL method not found: 'runProguard'
  • MenuItem's checked state is not shown correctly by its icon
  • Drawing paths and hardware acceleration
  • Android 4.2.1, WebView and javascript interface breaks
  • 5 Solutions collect form web for “Is Secure.ANDROID_ID unique for each device?”

    Check into this thread,. However you should be careful as it’s documented as “can change upon factory reset”. Use at your own risk, and it can be easily changed on a rooted phone. Also it appears as if some manufacturers have had issues with their phones having duplicate numbers thread. Depending on what your trying to do, I probably wouldnt use this as a UID.

    So if you want something unique to the device itself, TM.getDeviceId() should be sufficient.

    Here is the code which shows how to get Telephony manager ID. The android Device ID that you are using can change on factory settings and also some manufacturers have issue in giving unique id.

    TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
    Log.d("ID", "Android ID: " + Secure.getString(getContentResolver(), Secure.ANDROID_ID));
    Log.d("ID", "Device ID : " + tm.getDeviceId());

    Be sure to take permissions for TelephonyManager by using

    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    With Android O the behaviour of the ANDROID_ID will change. The ANDROID_ID will be different per app per user on the phone.

    Taken from:

    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
    • 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.

    I’ve read a few things about this and unfortunately the ANDROID_ID should not be relied on for uniquely identifying an individual device.

    It doesn’t seem to be enforced in Android compliance requirements and so manufacturers seem to implement it the way they choose including some using it more as a ‘model’ ID etc.

    Also, be aware that even if a manufacturer has written a generator to make it a UUID (for example), it’s not guaranteed to survive a factory reset.

    Just list an alternaitve solution here, the Advertising ID:

    Copied from the link above:

    The advertising ID is a unique, user-resettable ID for advertising, provided by Google Play services. It gives users better controls and provides developers with a simple, standard system to continue to monetize their apps. It enables users to reset their identifier or opt out of personalized ads (formerly known as interest-based ads) within Google Play apps.

    The limitations are:

    1. Google Play enabled devices only.
    2. Privacy Policy:
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.