android 获取手机唯一识别码


//如果获取不到imsi号,就拼接其它信息获取唯一码:

结论是,依然有部分手机获取不到。

final TelephonyManager tm = (TelephonyManager) getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
     String uuid = tm.getSubscriberId();
     if(CommonUtil.isEmpty(uuid)){
     uuid = getMyUUID(tm);
     }

//UUID+设备号序列号 唯一识别码(不可变)
private String getMyUUID(TelephonyManager tm){
 final String tmDevice, tmSerial, tmPhone, androidId;   
 tmDevice = "" + tm.getDeviceId();  
 tmSerial = "" + tm.getSimSerialNumber();   
 androidId = "" + android.provider.Settings.Secure.getString(getContentResolver(),android.provider.Settings.Secure.ANDROID_ID);   
 UUID deviceUuid = new UUID(androidId.hashCode(), ((long)tmDevice.hashCode() << 32) | tmSerial.hashCode());   
 String uniqueId = deviceUuid.toString();
 Log.d("debug","uuid="+uniqueId);
        return uniqueId;
}


getNativePhoneNumber获取的手机号

DeviceId(IMEI)手机 国际移动用户识别码

NetworkOperator 移动运营商编号

NetworkOperatorName 移动运营商名称

SimSerialNumber  SimOperator  SimCountryIso  SimSerialNumber  SubscriberId(IMSI)   关于手机SIM卡的一些详细信息。



猜你喜欢

转载自blog.csdn.net/hualizide/article/details/41545545