Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Settings.Secure.ANDROID_ID is not unique, how to solve?

I'm facing now a big issue. As found in Android official reference: http://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID


public static final String ANDROID_ID

*Added in API level 3

A 64-bit number (as a hex string) that is randomly generated on the device's first boot and should remain constant for the lifetime of the device. (The value may change if a factory reset is performed on the device.) Constant Value: "android_id"*


But with over 500 tablet sold (A10 AllWinner) ANDROID_ID is not really generated randomly and I see (from my web service log) that several devices have the same number!

Why?

How can I solve this issue? How can I generate a unique ID? Assume that the serial code is always the same for all devices (Same serial number on several android devices. Adb is useless. How can I change the serial number?) and MAC address could not be always available.

like image 387
Seraphim's Avatar asked Feb 15 '13 09:02

Seraphim's


People also ask

Is Secure Android_id unique?

Since Android 8, android_id is "unique to each combination of app-signing key, user, and device" so as to deny "developers the ability to track users across multiple applications".

What is secure Android_id?

ANDROID_ID. On Android 8.0 (API level 26) and higher versions of the platform, a 64-bit number (expressed as a hexadecimal string), unique to each combination of app-signing key, user, and device.

How do I use secure settings?

To enable the screen lock or change how you access your device, go to Settings > Security > Device Security. Tap on the Screen lock option, and you can choose from security options such as Swipe, Pattern, Pin, or Password.

What is Ssaid in Android?

The SSAID or android_id is a persistent hardware identifier that is “common between apps signed by the same developer signing key.” Branch utilizes this for many use cases such as Fraud and to provide the best user experience across different apps.


1 Answers

In general this is a serious problem with Android - it seems the Android ID is the best option BUT as you note several significant vendors have made a mess of the implementation.

Confronted by a similar requirement I have used a hash of these values:

  • Phone number/SIM card number (if available or just use zeros)
  • Android ID
  • Mac Address (if available or just use zeros)

In my limited experience (several hundred devices in use) this combination has been good enough to achieve the uniqueness you need.

Update 2017 from Android 6 the Mac address returns a constant value for security reasons - however in almost all newer implementations of android the android ID seems to be reliably unique so unless you are targeting older versions you would have no motive to use this technique.

like image 54
Elemental Avatar answered Nov 01 '22 18:11

Elemental