android - 从安卓手机获取IMSI?

标签 android

我正在开发一个需要获取 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/

相关文章:

Android 浏览器在每次 play() 后卸载 HTML5 音频元素,导致延迟

android - 如何从 Android NDK 获取资源中的文件

android - 在 Eclipse 中调试 Android 应用程序不起作用

android - 带有协程的Android应用程序中的Scarlet websocket

android - Android Studio如何同时显示两个或多个logcat过滤器?

android - jenkins android 构建失败 :"Execution failed for task ' :app:compileReleaseAidl'", 但使用 androidstudio 构建是好的,有人可以告诉我为什么

android - MPAndroidChart PieChart如何更改中心文本以显示不同的颜色和大小

android - 如何在android中的文本和下划线之间添加间距?

android - 改造POJO为空

android - 从Bamboo运行时在根项目中找不到任务 'assemble'