首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

绝无仅有的 device id

2012-09-12 
独一无二的 device id两个概念?IMSI (International Mobile Subscriber Identity) of the SIM-Card presen

独一无二的 device id

两个概念

?IMSI (International Mobile Subscriber Identity) of the SIM-Card present in your mobile and the IMEI (International Mobile Equipment Identity). The IMSI identifies with the SIM, the IMEI with the device.
IMSI用来标记sim卡 而IMEI用来标记设备的

获取方法:

String myIMSI = android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMSI);
// emulator returns: 310995000000000

String myIMEI = android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMEI);
// emulatorreturns: 000000000000000

2.

TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String imsi = mTelephonyMgr.getSubscriberId();
String imei = mTelephonyMgr.getDeviceId();?

set <uses-permission android:name="android.permission.READ_PHONE_STATE"/> in AndroidManifest.xml.

?

3.String unique_id = android.provider.Settings.Secure.getString(getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);?
4.String imei = TelephonyManager.getDefault().getDeviceId();?
if (TextUtils.isEmpty(imei)) {?
? ?return "";?
}?

热点排行