Settings.Secure.ANDROID_ID is not unique, how to solve?

前端 未结 1 1887
小蘑菇
小蘑菇 2021-02-10 19:22

I\'m facing now a big issue. As found in Android official reference: http://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID


相关标签:
1条回答
  • 2021-02-10 20:23

    In general this is a serious problem with Android - it seems the Android ID is the best option BUT as you note several significant vendors have made a mess of the implementation.

    Confronted by a similar requirement I have used a hash of these values:

    • Phone number/SIM card number (if available or just use zeros)
    • Android ID
    • Mac Address (if available or just use zeros)

    In my limited experience (several hundred devices in use) this combination has been good enough to achieve the uniqueness you need.

    Update 2017 from Android 6 the Mac address returns a constant value for security reasons - however in almost all newer implementations of android the android ID seems to be reliably unique so unless you are targeting older versions you would have no motive to use this technique.

    0 讨论(0)
提交回复
热议问题