gpt4 book ai didi

java - 为什么不推荐使用 "using getString() to get device identifiers"?

转载 作者:IT老高 更新时间:2023-10-28 21:13:04 36 4
gpt4 key购买 nike

我正在尝试将我的设备 ID 获取到 Logcat,但 Android Studio 给了我这个警告。

using getstring to get device identifiers is not recommended

String deviceID = Settings.Secure.getString(getApplicationContext().getContentResolver(),
Settings.Secure.ANDROID_ID);

为什么不推荐?

最佳答案

完整的警告说:

Using these device identifiers is not recommended otherthan for high value fraud prevention and advanced telephony use-cases.For advertising use-cases, use AdvertisingIdClient$Info#getId and foranalytics, use InstanceId#getId.

More info:https://developer.android.com/training/articles/user-data-ids.html

我认为 Android 不建议使用这个值,因为它是一个永久唯一的 id,可以用来跟踪你的用户,他或她不能改变这个 id 或阻止你阅读它。警告中给出的其他选项尊重用户的意愿。这就是 Android 建议您使用它的原因。

这实际上取决于您要使用该 ID 做什么。如今,隐私是一件敏感的事情。

也检查一下:

...you must abide by a user’s ‘Opt out of interest-based advertising’or 'Opt out of Ads Personalization' setting. If a user has enabledthis setting, you may not use the advertising identifier for creatinguser profiles for advertising purposes or for targeting users withpersonalized advertising. Allowed activities include contextualadvertising, frequency capping, conversion tracking, reporting andsecurity and fraud detection.

来源:https://developer.android.com/training/articles/user-data-ids.html

关于java - 为什么不推荐使用 "using getString() to get device identifiers"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47691310/

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