Getting Android Device Identifier From ADB and Android SDK

前端 未结 12 914
一生所求
一生所求 2021-01-30 17:24

I am looking for the easiest way to get a unique android device identifier from both the Android adb and the Android ADK itself.

For example, when i use the adb \'devi

相关标签:
12条回答
  • 2021-01-30 17:50

    Try ANDROID_ID. As documentation says "[it] is randomly generated on first boot and should remain constant for the lifetime of the device".

    0 讨论(0)
  • 2021-01-30 17:50

    I use adb. First I list the attached device ID numbers with the following command:

    adb devices
    

    And the output will look something like this:

    List of devices attached
    YOGAA1BBB412    device
    

    From the previous output, you will need the device ID number (eg: YOGAA1BBB412). To get the Device ID, I use the following adb command:

    adb -s YOGAA1BBB412 shell getprop | grep product.model
    

    And the output looks like this:

    [ro.product.model]: [Lenovo YT3-X90F]
    
    0 讨论(0)
  • 2021-01-30 17:50

    Use getprop net.hostname which has an Android unique Id followed by keyword android-<64 bit Hexadecimal String>

    example:

    [net.hostname]: [android-a487e0560d669e4a]
    
    0 讨论(0)
  • 2021-01-30 17:58

    To find everything about connected usb device on ubuntu use below command lsusb -v
    See the link it will give u device id like Bus 001 Device 005: ID 18d1:4ee7 Google Inc. So use first four "18d1" to add android usb rules

    0 讨论(0)
  • 2021-01-30 18:02

    The Android serial number can be retreived within the device with getprop :

    getprop ro.serialno

    From Java, you may want to execute it with Runtime.exec()

    0 讨论(0)
  • 2021-01-30 18:04

    you should probably use IMEI:

        TelephonyManager m = (TelephonyManager) context
                .getSystemService(Context.TELEPHONY_SERVICE);
        String imei = m != null ? m.getDeviceId() : null;
    
    0 讨论(0)
提交回复
热议问题