how to get imsi number in android using command line
Solution 1
To call TelephonyManager.getSubscriberId()
in Android versions 5.x-7.x via adb shell
run:
adb shell service call iphonesubinfo 7
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
Also read Calling Android services from ADB shell for more details.
Solution 2
adb shell getprop ril.iccid.sim1
If you want to know all data you can use only adb shell getprop
, that shows you all of them, and you see that some items show you the IMSI like item ril.iccid.sim1
or persist.radio.cfu.iccid.0
user1865411
Updated on April 16, 2021Comments
-
user1865411 about 3 years
I want to get
IMSI
number of SIM ofAndroid
phone using command line.Is there any adb command or any shell command in android for this???
I tried
adb shell getprop ril.IMSI
command in Samsung Galaxy ace, it works. It gives meIMSI
number. But I tried the same command in Samsung Galaxy S3. It doesn't return anything.I want to get
IMSI
number of SIM card inSamsung Galaxy S3
using command line only. (Not Android Application code) either usingadb
command or some shell command inAndroid
.Also, I know there is a simple code in
JAVA
to run in Android Application which givesIMSI
number:TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); String imsi = mTelephonyMgr.getSubscriberId();
Can I somehow run this
Android Java
code from command line? This will also solve my problem.