//get IMEI码
String IMEI = this.getSystemService(Context.TELEPHONY_SERVICE).getDeviceId();
String IMEI = this.getSystemService(Context.TELEPHONY_SERVICE).getDeviceId();
String myIMSI =android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMSI);
//打印
System.out.println("IMEI:" + IMEI);
修改Manifest.xml中权限:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />