简体   繁体   English

Android设备ID-卸载/重新安装后仍然存在

[英]Android Device ID - Persist after uninstall / reinstall

I'm using the following method to create unique identifiers on Android: https://gist.github.com/shareme/2759664 我正在使用以下方法在Android上创建唯一标识符: https : //gist.github.com/shareme/2759664

This works fine, but when deleting the app, a new identifier is created which is undesirable. 这可以正常工作,但是在删除应用程序时,会创建一个新的标识符,这是不希望的。

How can I persist this unique identifier across uninstall / reinstall but still have one UUID per device a user has. 我如何在卸载/重新安装过程中保留该唯一标识符,但用户拥有的每个设备仍具有一个UUID。

I've researched multiple things already, but didn't find a clean solution yet. 我已经研究了很多东西,但是还没有找到一个干净的解决方案。

Bonus question: Is this UUID-method really globally unique? 额外的问题:这个UUID方法真的在全球范围内是唯一的吗? Is it absolutely collision-safe? 它绝对是碰撞安全的吗?

As per Android guidelines you should be using the AdvertiserID. 根据Android准则,您应该使用AdvertiserID。 Yes, it's truly unique, but user can reset it. 是的,它确实是唯一的,但是用户可以重置它。
If you absolutely need a uuid that survives uninstalls and cannot be reset, you can use the openUUID library, which survives on almost all devices. 如果您绝对需要一个在卸载后仍然可以生存且无法重置的uuid,则可以使用openUUID库,该库在几乎所有设备上都可以生存。 It basically uses the device serial number, which Android advises against. 它基本上使用Android建议的设备序列号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM