六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 43|回复: 0

独一无二的 device id

[复制链接]

升级  82%

292

主题

292

主题

292

主题

进士

Rank: 4

积分
910
 楼主| 发表于 2013-1-15 02:23:17 | 显示全部楼层 |阅读模式
两个概念
 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 ""

您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表