我正在开发一个需要获取 IMSI 的应用。我用:
TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String imsi = mTelephonyMgr.getSubscriberId();
它适用于大多数手机,但少数手机只返回 6 位而不是 15 位。这是错误的。
有人知道以编程方式检索 IMSI 的替代方法吗?其他 API?方法?
问候
最佳答案
根据this post你可以使用
String imsi = android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMSI);
但 SystemProperties 无法直接访问,因此您需要使用以下技巧之一来回答此问题:Where is android.os.SystemProperties
您可能还需要 SystemProperties
source .
关于android - 从安卓手机获取IMSI?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5656558/