Getting Android Device Identifier From ADB and Android SDK

前端 未结 12 916
一生所求
一生所求 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:43

    adb shell settings get secure android_id

    This command returns ANDROID_ID but it may not be the same as ANDROID_ID received at code level. The application can use different min API level and the value obtained from adb shell may not match

    It was possible to get the ANDROID_ID from [net.hostname] prop. It worked in API level 23.

    Command to get the android_id for API level 23

    adb shell getprop net.hostname

    In android 8.0 and above this prop returns null due to android privacy policy changes. Hence, ANDROID_ID doesn't remain to be a reliable method of unique device id comparison.

提交回复
热议问题