Friday, July 17, 2015

command line - How to get 2nd IMEI number using adb?


I am currently using this command adb shell "service call iphonesubinfo 1" to get IMEI number, but it only returns 1st one.


Does anyone know how I can get the 2nd IMEI number?



Answer




Which code to use with service call depends on Android release. On Android 9 IPhoneSubInfo method 1 returns first IMEI while methods 3 and 4 return both IMEIs:


~$ service call iphonesubinfo 3 i32 1 | grep -oE '[0-9a-f]{8} ' | while read hex; do echo -ne "\u${hex:4:4}\u${hex:0:4}"; done; echo
~$ service call iphonesubinfo 3 i32 2 | grep -oE '[0-9a-f]{8} ' | while read hex; do echo -ne "\u${hex:4:4}\u${hex:0:4}"; done; echo

Related: How to check IMSI/ICCID on MIUI10?


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...