当前位置: 代码迷 >> Android >> 获取设备唯一标识的有关问题
  详细解决方案

获取设备唯一标识的有关问题

热度:62   发布时间:2016-05-01 22:19:37.0
获取设备唯一标识的问题
如果获取一个设备的唯一的一个标识

不一定是手机,有可能是平板电脑

------解决方案--------------------
Java code
Settings.Secure.getString(this.getContentResolver(), Settings.System.ANDROID_ID);
------解决方案--------------------
public String getId() {
String id = android.provider.Settings.System.getString(super.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
return id;
}
------解决方案--------------------
TelephonyManager tm = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
String deviceId = tm.getDeviceId();
------解决方案--------------------
探讨

TelephonyManager tm = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
String deviceId = tm.getDeviceId();
  相关解决方案