Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What should the Android device ID length be

Tags:

android

udid

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);
like image 527
SampathKumar Avatar asked Jul 20 '12 14:07

SampathKumar


2 Answers

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

like image 88
mschwaig Avatar answered Sep 20 '22 18:09

mschwaig


i have two device using this code

String device_id =  Secure.getString(getContentResolver(), Secure.ANDROID_ID);
like image 41
Parag Chauhan Avatar answered Sep 19 '22 18:09

Parag Chauhan