android获取imei和imsi

TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

String imsi = mTelephonyMgr.getSubscriberId();
String imei = mTelephonyMgr.getDeviceId();
Log.i("IMSI", imsi);
Log.i("IMEI", imei);

==============================================================================

另外不要忘了在AndroidManifest.xml中加上读取手机状态的权限

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

http://blog.sina.com.cn/s/blog_60a9446b0100lxuk.html

你可能感兴趣的:(android)