Is there an android shell or adb command that I co

2019-01-11 12:40发布

Is there some adb or android shell command that I could run that would return a device's IMEI or MEID number? Preferably that's all that would be returned.

标签: android adb
7条回答
你好瞎i
2楼-- · 2019-01-11 13:07

Just run ./adb devices and it lists all connected IMEIs.

查看更多
萌系小妹纸
3楼-- · 2019-01-11 13:10

For ESN you can do

service call iphonesubinfo 16

at least it gives me the right one on Motorola Photon Q.

To clean it up (assuming you have shell on the device and have a capable busybox there, if not I highly recommend one):

    service call iphonesubinfo 16 | busybox awk -F "'" '{print $2}' | busybox sed 's/[^0-9A-F]*//g' | busybox tr -d '\n' && echo

For MEID with cleanup:

service call iphonesubinfo 1 | busybox awk -F "'" '{print $2}' | busybox sed 's/[^0-9A-F]*//g' | busybox tr -d '\n' && echo
查看更多
啃猪蹄的小仙女
4楼-- · 2019-01-11 13:21

This works for me on my nexus 5 and moto 5G.

output:

[build.id]: [M4B30X]
[build.version.release]: [6.0.1]
[build.version.sdk]: [23]
[build.version.security_patch]: [2016-10-05]
[product.brand]: [google]
[product.manufacturer]: [LGE]
[product.model]: [Nexus 5]
[product.name]: [hammerhead]
[serialno]: [05xxxxxxxxxxx4]
[device.imei]: [xxxxxxxxxxxx]
[device.phonenumber]: [+xxxxxxxxxx]

Script: get.deviceinfo.bash

#!/bin/bash
# Get the device properties
adb shell getprop | grep "model\|version.sdk\|manufacturer\|ro.serialno\|product.name\|brand\|version.release\|build.id\|security_patch" | sed 's/ro\.//g'
# get the device ime
echo "[device.imei]: [$(adb shell service call iphonesubinfo 1 | awk -F "'" '{print $2}' | sed '1 d'| tr -d '\n' | tr -d '.' | tr -d ' ')]"
# get the device phone number
echo "[device.phonenumber]: [$(adb shell service call iphonesubinfo 19 | awk -F "'" '{print $2}' | sed '1 d'| tr -d '\n' | tr -d '.' | tr -d ' ')]"

It requires:

查看更多
劳资没心,怎么记你
5楼-- · 2019-01-11 13:21

IMEI- adb shell service call iphonesubinfo 1 | awk -F "'" '{print $2}' | sed '1 d'| sed 's/.//g' | awk '{print}' ORS=''

Android ID=

adb shell settings get secure android_id

查看更多
Root(大扎)
6楼-- · 2019-01-11 13:23

I figured out how to do this. You need to run adb shell dumpsys iphonesubinfo in a shell. It will give you a bit more than you need, but it will also return IMEI or MEID number.

Edit (2017): In Android 5.0+ you'll need to use the service call command. More info about that can be found here.

查看更多
Explosion°爆炸
7楼-- · 2019-01-11 13:24

For IMEI you can use:

adb shell service call iphonesubinfo 1 | awk -F "'" '{print $2}' | sed '1 d' | tr -d '.' | awk '{print}' ORS=
查看更多
登录 后发表回答