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?
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?