如何在Android 5.0上使用adb命令获取MEID和IMEI信息?

Kri*_*ann 5 android adb

我知道唯一适用于其他版本的命令是"adb shell dumpsys iphonesubinfo",但它似乎不适用于Android 5.0.

Ale*_* P. 15

为了让TelephonyManager.getDeviceId()你能做到:

adb shell service call iphonesubinfo 1
Run Code Online (Sandbox Code Playgroud)

如果您在解析service call输出时遇到问题,请查看https://gist.github.com/ktnr74/60ac7bcc2cd17b43f2cb

或者您可以使用此Windows单行程序在设备端执行此操作:

adb shell "service call iphonesubinfo 1 | grep -o '[0-9a-f]\{8\} ' | tail -n+3 | while read a; do echo -n \\u${a:4:4}\\u${a:0:4}; done"
Run Code Online (Sandbox Code Playgroud)

或者在Linux中:

adb shell 'service call iphonesubinfo 1 | grep -o "[0-9a-f]\{8\} " | tail -n+3 | while read a; do echo -n "\u${a:4:4}\u${a:0:4}"; done'
Run Code Online (Sandbox Code Playgroud)