Android 设备 ID 长度应该是多少
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11581177/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What should the Android device ID length be
提问by SampathKumar
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.
谁能告诉我Android中设备UDID的长度,因为我在Android中得到了UDID并且它只有16个字符,但iPhone UDID长度是40。
I am using the following code to detect the ID:
我正在使用以下代码来检测 ID:
id = android.provider.Settings.System.getString(super.getContentResolver(),
android.provider.Settings.Secure.ANDROID_ID);
回答by Parag Chauhan
i have two device using this code
我有两个设备使用此代码
String device_id = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
回答by mschwaig
The Android ID is
安卓 ID 是
UP TO 16 characters long
最多 16 个字符长
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
因为至少在某些出现在野外的 Android 版本中不会假装前导零。看看这个对类似问题的回答,为什么会这样: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
文档在此处将其指定为64 位数字(表示为十六进制字符串):https: //developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID