Is there an android shell or adb command that I could use to get a device's IMEI/MEID?

后端 未结 8 925
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-03 02:44

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.

8条回答
  •  失恋的感觉
    2020-12-03 03:22

    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:

    • UBS debugging ON (developer options)
    • adb (Android SDK Platform Tools)

提交回复
热议问题