'Getting IMEI number using ADB commands Android 12
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 ?
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Karsten |