<分区>
我正在尝试使用以下代码获取唯一 ID[I.E 设备的唯一 ID]
TelephonyManager tManager;
tManager = (TelephonyManager).getSystemService(Context.TELEPHONY_SERVICE);
String deviceId = tManager.getDeviceId();
deviceId
给我 Android 设备的唯一 ID。我没有在模拟器上测试这个,因为在模拟器中我得到值 000000000000000
我在真实设备上测试它的任何方式,这对大多数设备都适用,但在某些设备上我得到值 null
我已经测试过了
Samsung Galaxy S3
Samsung Galaxy Tab3
Samsung Galaxy Star
Google Nexus4
Google Nexus5
Google Nexus7
在上面列出的所有设备中,它给了我正确的输出,除了一个设备,那就是 Google Nexus7
,在这个我得到值 null
因此,最终我的目标是为每个特定设备获取唯一值,以防万一此代码给我空值,我可以尝试其他方法
我听说 Device MAC Address
对所有设备都是唯一的,但不幸的是它只适用于 wifi 连接。
那么有没有其他方法可以获得每个特定设备的独特值(value)?
谢谢