【问题标题】:Settings.Secure.ANDROID_ID different in build APK and Signed APK why?为什么构建 APK 和签名 APK 中的 Settings.Secure.ANDROID_ID 不同?
【发布时间】:2020-09-14 06:34:21
【问题描述】:
String androidId = Settings.Secure.getString(getContentResolver(),
                     Settings.Secure.ANDROID_ID);

我正在使用它来获取 android id。怀疑ANDROID_ID对于签名的apk和构建同一设备的apk有何不同? 我需要我的设备的唯一身份。如果 ANDROID_ID 改变了,那么用这个好不好?

【问题讨论】:

    标签: android firebase firebase-cloud-messaging uniqueidentifier deviceid


    【解决方案1】:

    Android 8.0+ randomizes the ANDROID_ID value:

    对于安装在运行 Android 8.0 的设备上的应用,ANDROID_ID 的值现在以每个应用签名密钥和每个用户为范围。 ANDROID_ID 的值对于应用签名密钥、用户和设备的每个组合都是唯一的。因此,在同一设备上运行的具有不同签名密钥的应用不再看到相同的 Android ID(即使对于同一用户也是如此)。

    documentation 提供有关唯一标识符的详尽指南。此外,请务必与律师讨论您的计划。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-01
    • 2020-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多