adb shell dumpsys iphonesubinfo not working since Android 5.0 Lollipop
IMEI for sim 1
adb shell service call iphonesubinfo 1 | awk -F "'" '{print $2}' | sed '1 d' | tr -d '.' | awk '{print}' ORS=
ADB command to get device IMEI:
adb shell "service call iphonesubinfo 1 | cut -c 52-66 | tr -d '.[:space:]'"
ADB command to get device phone number:
adb shell "service call iphonesubinfo 18 | cut -c 52-66 | tr -d '.[:space:]+'"
ADB command to get Android ID:
adb shell settings get secure android_id
ADB command to get device Serial Number:
adb shell getprop ro.serialno
Note: No root is needed for any of the above commands
You can always just use service call
command to call the service methods.
here are the TRANSACTION CODES for the iphonesubinfo
service in android-5.0.0_r1
:
1 getDeviceId
2 getDeviceIdForSubscriber
3 getImeiForSubscriber
4 getDeviceSvn
5 getSubscriberId
6 getSubscriberIdForSubscriber
7 getGroupIdLevel1
8 getGroupIdLevel1ForSubscriber
9 getIccSerialNumber
10 getIccSerialNumberForSubscriber
11 getLine1Number
12 getLine1NumberForSubscriber
13 getLine1AlphaTag
14 getLine1AlphaTagForSubscriber
15 getMsisdn
16 getMsisdnForSubscriber
17 getVoiceMailNumber
18 getVoiceMailNumberForSubscriber
19 getCompleteVoiceMailNumber
20 getCompleteVoiceMailNumberForSubscriber
21 getVoiceMailAlphaTag
22 getVoiceMailAlphaTagForSubscriber
23 getIsimImpi
24 getIsimDomain
25 getIsimImpu
26 getIsimIst
27 getIsimPcscf
28 getIsimChallengeResponse
29 getIccSimChallengeResponse
Most methods require root
. But fortunately getDeviceId
(the one you need to get device's IMEI/MEID) does not.
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.