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 ?
Here's what's working on my device on Android 12:
iphonesubinfocalls 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 1seems to report the IMEI on previous Android version as well though, at least from Android 10 on.