自Android 5.0 Lollipop以来,adb shell dumpsys iphoneubinfo无法运行

Jér*_*émy 15 android adb android-5.0-lollipop

我们以前使用以下命令获取设备ID/IMEI:

adb shell dumpsys iphonesubinfo
Run Code Online (Sandbox Code Playgroud)

但自上次Android更新(5.0 - Lollilop)以来,此命令不返回任何内容,我在Nexus 4和Nexus 5上都执行了此测试.

我知道我可以从代码中获取IMEI,这仍然有效,但有没有人有针对ADB的解决方法?

小智 9

IMEI for sim 1

adb shell service call iphonesubinfo 1 | awk -F "'" '{print $2}' | sed '1 d' | tr -d '.' | awk '{print}' ORS=
Run Code Online (Sandbox Code Playgroud)

  • 我已将其修改为在 Windows 上工作: `adb shell "service call iphonesubinfo 1 | awk -F \"'\" '{print $2}' | sed '1 d' | tr -d '.' | awk '{print}' ORS="` (2认同)

Ale*_* P. 8

您始终可以使用service call命令来调用服务方法.

以下是该iphonesubinfo服务的TRANSACTION CODES android-5.0.0_r1:

 1  getDeviceId
 2  getDeviceIdForSubscriber
 3  getImeiForSubscriber
 4  getDeviceSvn
 5  getSubscriberId
 6  getSubscriberIdForSubscriber
 7  getGroupIdLevel1
 8  getGroupIdLevel1ForSubscriber
 9  getIccSerialNumber
10  getIccSerialNumberForSubscriber
11  getLine1Number
12  getLine1NumberForSubscriber
13  getLine1AlphaTag
14  getLine1AlphaTagForSubscriber
15  getMsisdn
16  getMsisdnForSubscriber
17  getVoiceMailNumber
18  getVoiceMailNumberForSubscriber
19  getCompleteVoiceMailNumber
20  getCompleteVoiceMailNumberForSubscriber
21  getVoiceMailAlphaTag
22  getVoiceMailAlphaTagForSubscriber
23  getIsimImpi
24  getIsimDomain
25  getIsimImpu
26  getIsimIst
27  getIsimPcscf
28  getIsimChallengeResponse
29  getIccSimChallengeResponse
Run Code Online (Sandbox Code Playgroud)

大多数方法需要root.但幸运的是getDeviceId(获得设备的IMEI/MEID所需的那个)没有.

要在设备端正确解析service call命令输出而没有外部依赖性,请在此处查看我的答案

另请参阅从ADB shell调用Android服务以获取更多详细信息.


Dev*_*lpr 7

ADB命令获取设备IMEI:

adb shell "service call iphonesubinfo 1 | cut -c 52-66 | tr -d '.[:space:]'"

ADB命令获取设备电话号码:

adb shell "service call iphonesubinfo 18 | cut -c 52-66 | tr -d '.[:space:]+'"

获取Android ID的ADB命令:

adb shell settings get secure android_id

ADB命令获取设备序列号:

adb shell getprop ro.serialno

注意:上述任何命令都不需要 root