【问题标题】:How To Uniquely Identify An Android Device? [duplicate]如何唯一标识一台安卓设备? [复制]
【发布时间】:2013-11-05 08:40:35
【问题描述】:

我正在开发一个允许用户从多个 android 设备登录的应用程序(服务器-android 客户端)。当用户登录设备时,该设备将在服务器端注册,但我不知道如何避免重复,所以我想知道有没有机会唯一识别一个 android 设备?我认为 Google Play 和 Facebook 可以做到这一点。

【问题讨论】:

    标签: android


    【解决方案1】:

    您可以查看设备的IMEIMAC地址。

    IMEI

    TelephonyManager.getDeviceId 可以工作

    MAC

    WifiInfo.getMacAddress 可以工作

    【讨论】:

    • 是的,但是如何通过 adb shell 获取 wifi 地址?
    • @StinePike 我正在使用imei。如果用户使用这个应用程序play.google.com/store/apps/…,那么我们会得到错误的imei。
    • 从 Android 官方网站获取的注释:It is generally not recommended to use MAC address for any form of user identification. As a result, as of Android M, local device MAC addresses (for example, Wifi and Bluetooth) are not available via third party APIs. The WifiInfo.getMacAddress() method and the BluetoothAdapter.getDefaultAdapter().getAddress() method will both return 02:00:00:00:00:00.
    • MAC 地址可以通过 NetworkInterface.getNetworkInterfaces() 或 DevicePolicyManager 获取。
    • 那些不再适用于 Android Q :(
    【解决方案2】:

    有多种可用选项,但不能 100% 保证它们始终有效。见安卓开发者博文:http://android-developers.blogspot.in/2011/03/identifying-app-installations.html

    提到的最佳方法是Settings.Secure.ANDROID_ID

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-31
    相关资源
    最近更新 更多