英文:
Get IMEI via ADB only for old Huawei models
问题
I can provide translations for the non-code portions of your text:
-
我需要一点帮助。我有一部华为 g6-l11 手机(搭载 Android 4.3),我正在尝试通过 ADB 提取 IMEI。我知道这部手机很老,但这是我的一个任务。到目前为止,我尝试了互联网上能找到的所有方法,比如:
-
adb shell service call iphonesubinfo N | grep "<IMEI>"
- 其中 N 是介于 1 和 50 之间的数字 -
adb shell settings get secure android_id
-
adb shell content query --uri content://settings/secure | grep "<IMEI>"
-
adb shell content query --uri content://settings/system | grep "<IMEI>"
-
adb shell content query --uri content://settings/global | grep "<IMEI>"
-
adb shell dumpsys | grep "<IMEI>"
因此,我创建了一个 Android 应用程序并在智能手机上运行了以下代码:
val tm = this.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
Log.d("Emy_","The IMEI is ${tm.deviceId}")
这个方法运行得很好,但这是一个 Android 应用程序,而我需要通过 ADB 来执行相同的操作。
此外,我找到了一个 fastboot 命令,可以帮助我(例如:fastboot oem get-psid
)。但问题是我需要将手机重启到 fastboot 模式,这需要太长时间。
我的问题是:
-
为什么对于安卓 6.0 以下版本的华为手机来说提取 IMEI 不同?
-
如何复制 Java 代码中的函数调用,用终端中的 ADB 执行?换句话说,您能向我推荐哪些其他命令来尝试提取 IMEI?
英文:
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:
-
adb shell getprop | grep "<IMEI>"
-
adb shell service call iphonesubinfo N | grep "<IMEI>"
- Where N is a number between 1 and 50 -
adb shell settings get secure android_id
-
adb shell content query --uri content://settings/secure | grep "<IMEI>"
-
adb shell content query --uri content://settings/system | grep "<IMEI>"
-
adb shell content query --uri content://settings/global | grep "<IMEI>"
-
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:
-
why is it different for Huawei models with the OS version below Marshmallow to extract the IMEI?
-
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?
答案1
得分: 1
你可以在屏幕上显示它:
adb am start -a android.intent.action.CALL -d tel:*%2306%23
英文:
You could display it on screen:
adb am start -a android.intent.action.CALL -d tel:*%2306%23
答案2
得分: 0
如果您只是想知道IMEI号码,您可以尝试以下代码:*#06#
或者您可以尝试这个:adb shell service call iphonesubinfo 1 | toybox cut -d ""'"" -f2 | toybox grep -Eo '[0-9]' | toybox xargs | toybox sed 's/\ //g'
希望这对您有帮助!
英文:
If you just searching to know the IMEI, You can try this code : *#06#
Or you can try this : adb shell
service call iphonesubinfo 1 | toybox cut -d "'" -f2 | toybox grep -Eo '[0-9]' | toybox xargs | toybox sed 's/\ //g'
hop that help you !
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论