5

For android versions before 11 I was using the below command to get IMEI number from my device:

adb shell "service call iphonesubinfo 4 | cut -c 52-66 | tr -d '.[:space:]'"

or

adb shell service call iphonesubinfo 1 | toybox cut -d "'" -f2 | toybox grep -Eo '[0-9]' | toybox xargs | toybox sed 's/\ //g'

From android 12 it's not working anymore, these returns nothing

Can someone help with it ?

Robert
  • 39,162
  • 17
  • 99
  • 152

1 Answers1

4

Here's what's working on my device on Android 12:

adb root
adb shell "service call iphonesubinfo 1 i64 0 | cut -c 52-66 | tr -d '.[:space:]'"
  • The IMEI is accessible via root only
  • It wants an extra 64-bit integer to be sent to the service.

iphonesubinfo calls change somewhat with every Android version. I didn't check the implementations, so the code above is just result of experimenting with the service. iphonesubinfo 1 seems to report the IMEI on previous Android version as well though, at least from Android 10 on.

Karsten
  • 41
  • 3