android 什么工具可以读取imsi

2025-02-06 04:46:52
推荐回答(1个)
回答1:

The following code is deprecated.

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

String myIMEI = android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMEI);
// within my emulator it returns: 000000000000000

In order to get IMSI and IMEI, the following code works, assuming you write the code in a Activity class.

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

Do not forget to set in AndroidManifest.xml.