gpt4 book ai didi

ANDROID - 获取永久设备标识符 (UUID)

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:15:01 27 4
gpt4 key购买 nike

我需要一个在卸载并重新安装应用程序后仍然存在的设备标识符。我知道 UUID 类通过方法提供了一个标识符

String uniqueID = UUID.randomUUID().toString();

但 Android 指南并不清楚其范围和持久性。在下一段中它说:

The Android Operating system offers a number of IDs with different behavior characteristics and which ID you should use depends on how those following characteristics work with your use-case. But these characteristics also come with privacy implications so it's important to understand how these characteristics play together.

Scope

Identifier scope explains which systems can access the identifier. Android identifier scope generally comes in three flavors:

Single app. the ID is internal to the app and not accessible to other apps.

Group of apps - the ID is accessible to a pre-defined group of related apps.

Device - the ID is accessible to all apps installed on the device. The wider the scope granted to an identifier, the greater the risk of it being used for tracking purposes. Conversely, if an identifier can only be accessed by a single app instance, it can’t be used to track a device across transactions in different apps.

Resettability and persistence

Resettability and persistence define the lifespan of the identifier and explain how it can be reset. Common reset triggers are: in-app resets, resets via System Settings, resets on launch, and resets on installation. Android Identifiers can have varying lifespans, but the lifespan is usually related to how the ID is reset:

Session-only - a new ID is used every time the user restarts the app.

Install-reset - a new ID is used every time user uninstalls and reinstalls the app.

FDR-reset - a new ID is used every time the user factory-resets the device.

FDR-persistent - the ID survives factory reset.

Resettability gives users the ability to create a new ID that is disassociated from any existing profile information. This is important because the longer, and more reliably, an identifier persists (e.g. across factory resets etc.), the greater the risk that the user may be subjected to long-term tracking. If the identifier is reset upon app reinstall, this reduces the persistence and provides a means for the ID to be reset, even if there is no explicit user control to reset it from within the app or the System Settings.

但我不知道如何获取这些标识符,选择我的范围和持久性。谢谢

最佳答案

我正在使用这个:

String DeviceId = Settings.Secure.getString(c.getContentResolver(), Settings.Secure.ANDROID_ID);

看这个线程: Is there a unique Android device ID?

关于ANDROID - 获取永久设备标识符 (UUID),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37864844/

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