gpt4 book ai didi

android - 为什么返回 Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID) 一个空字符串;

转载 作者:行者123 更新时间:2023-11-29 18:30:06 25 4
gpt4 key购买 nike

我正在使用

Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);

但是返回值为空。

有什么想法吗?

谢谢

最佳答案

您使用的是模拟器吗?仿真器为此系统属性返回 null/空值。

此外,有趣的是,Android/Google 警告了一些关于使用 ANDROID_ID here 的事情

ANDROID_ID seems a good choice for a unique device identifier. There are downsides: First, it is not 100% reliable on releases of Android prior to 2.2 (“Froyo”). Also, there has been at least one widely-observed bug in a popular handset from a major manufacturer, where every instance has the same ANDROID_ID.

另外,请注意这个 warning , 如果您的应用面向 Android Oreo 或更高版本,则可能具有相关性

Note: For apps that were installed prior to updating the device to a version of Android 8.0 (API level 26) or higher, the value of ANDROID_ID changes if the app is uninstalled and then reinstalled after the OTA. To preserve values across uninstalls after an OTA to Android 8.0 or higher, developers can use Key/Value Backup.

关于android - 为什么返回 Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID) 一个空字符串;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56749126/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com