ANDROID – 获取持久性设备标识符(UUID)

在卸载并重新安装应用程序后,我需要一个设备标识符.我知道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性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...