如何使用命令行在Android中获取IMSI号 [英] how to get imsi number in android using command line
问题描述
我想使用命令行获取 Android
手机的 IMSI
SIM卡号。
I want to get IMSI
number of SIM of Android
phone using command line.
Android中是否为此有任何adb命令或任何shell命令?
Is there any adb command or any shell command in android for this???
我尝试了 adb shell Samsung Galaxy ace中的getprop ril.IMSI
命令,它可以工作。它给了我 IMSI
号。但是我在三星Galaxy S3中尝试了相同的命令。它不返回任何内容。
I tried adb shell getprop ril.IMSI
command in Samsung Galaxy ace, it works. It gives me IMSI
number. But I tried the same command in Samsung Galaxy S3. It doesn't return anything.
我想在 IMSI
的SIM卡号>仅使用命令行即可使用三星Galaxy S3 。 (不是Android应用程序代码)使用 adb
命令或 Android
中的某些shell命令。
I want to get IMSI
number of SIM card in Samsung Galaxy S3
using command line only. (Not Android Application code) either using adb
command or some shell command in Android
.
此外,我知道 JAVA
中有一个简单的代码可以在Android Application中运行,从而提供 IMSI
number:
Also, I know there is a simple code in JAVA
to run in Android Application which gives IMSI
number:
TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String imsi = mTelephonyMgr.getSubscriberId();
我可以以某种方式运行此 Android Java
代码从命令行?
Can I somehow run this Android Java
code from command line? This will also solve my problem.
推荐答案
调用 TelephonyManager.getSubscriberId()
在Android版本5.x-7.x中,通过 adb shell
运行:
To call TelephonyManager.getSubscriberId()
in Android versions 5.x-7.x via adb shell
run:
adb shell service call iphonesubinfo 7
此命令不再有效(例如,在大多数6.0+设备上)要求设备植根。
This command no longer (i.e. on most 6.0+ devices) requires the device to be rooted.
对于服务调用
的正确解析。在设备端且没有外部依赖性的命令输出,请参见我的在此处答复
For proper parsing of the service call
command output on the device side and without external dependencies see my answer here
也请阅读从ADB调用Android服务外壳以获取更多详细信息。
Also read Calling Android services from ADB shell for more details.
这篇关于如何使用命令行在Android中获取IMSI号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!