What should the Android device ID length be

SampathKumar picture SampathKumar · Jul 20, 2012 · Viewed 24.5k times · Source

Can anybody please tell me the length for device UDID in Android, because I got the UDID in android and it is only 16 characters, but the iPhone UDID length is 40.

I am using the following code to detect the ID:

id = android.provider.Settings.System.getString(super.getContentResolver(),
    android.provider.Settings.Secure.ANDROID_ID);

Answer

mschwaig picture mschwaig · Feb 8, 2018

The Android ID is

UP TO 16 characters long

since leading zeroes are not pretended at least in some versions of Android that appear in the wild. Take a look at this answer to a similar question for why that is: https://stackoverflow.com/a/29890124/2066744

The docs specify it as a 64-bit number (expressed as a hexadecimal string) here: https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID