Search code examples
androidadbhuawei-mobile-services

Get IMEI via ADB only for old Huawei models


I need a bit of assistance. I have a Huawei g6-l11 (with Android 4.3) from which I am trying to extract the IMEI via ADB. I know that this device is ancient, but this is one of my tasks. So far I had tried everything I could find on the internet, like:

1) adb shell getprop | grep "<IMEI>"

2) adb shell service call iphonesubinfo N | grep "<IMEI>" - Where N is a number between 1 and 50

3) adb shell settings get secure android_id

4) adb shell content query --uri content://settings/secure | grep "<IMEI>"

5) adb shell content query --uri content://settings/system | grep "<IMEI>"

6) adb shell content query --uri content://settings/global | grep "<IMEI>"

7) adb shell dumpsys | grep "<IMEI>"

So I had made an Android app and run this piece of code on the smartphone:

val tm = this.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
Log.d("Emy_","The IMEI is ${tm.deviceId}")

That worked fine but it is an Android app when I need to do the same thing but only via ADB.

Also, I had found a fastboot command that would help me (like: fastboot oem get-psid). But the problem is that I need to reboot the phone into fast boot mode. Which is taking too long.

My questions are:

1) why is it different for Huawei models with the OS version below Marshmallow to extract the IMEI?

2) how could I replicate the function call done by the Java code to be done with the ADB in the terminal? Or in other words, what other commands would you recommend to me to try to extract the IMEI?


Solution

  • You could display it on screen:

    adb am start -a android.intent.action.CALL -d tel:*%2306%23