Reputation: 314
There is a question about Getting IMEI number using ADB commands Android 12.
adb root
adb shell "service call iphonesubinfo 1 i64 0 | cut -c 52-66 | tr -d '.[:space:]'"
I tested the method, and it works well on Android 12.
But from android 13 on, it just returns an error message: "Package does not belong to ..."
Does anyone can help? Thanks!
Upvotes: 4
Views: 3614
Reputation: 71
adb shell "service call iphonesubinfo 1 s16 com.android.shell | cut -c 52-66 | tr -d '.[:space:]'"
Here is what you want
Upvotes: 7
Reputation: 52
Below ADB command uses UIAutomator of Android.
Method: Call app -> *#06# -> Get value
adb shell "imei=$(input keyevent KEYCODE_WAKEUP;input keyevent KEYCODE_CALL;sleep 1;input text '*#06#'; uiautomator dump --compressed /dev/stdout|sed s/\>\<\/\\n/g|grep -A1 IMEI1|tail -n1|sed -e 's/.*text=\"//' -e 's/\".*//'); echo ${imei:0:16}"
You can edit to get IMEI1, IMEI2, SN. My phone is Samsung Galaxy, if you use other phone brands, edit it accordingly.
Note: Not work when your phone is locked
Upvotes: -1