UUID.randomUUID() return 每次都是唯一值吗?

Is UUID.randomUUID() return unique value for each time?

我正在进行研发以获取 android 设备的唯一设备 ID,但 none 的解决方案似乎很完美。

UUID.randomUUID().toString();似乎是一个很好的解决方案,但我想知道在每次调用中这个函数是否 return 唯一值?如果它是真的比它好,我认为这也不是一个好的解决方案。

获取唯一设备ID的研发链接: 1: http://www.ssaurel.com/blog/how-to-retrieve-an-unique-id-to-identify-android-devices/ 2: Is there a unique Android device ID?

出于所有实际目的,UUID.randomUUID() 的结果是唯一的。但是,由于只有有限多个 UUID,很明显最终会出现重复。

UUID 有四种不同的基本类型:

Time-based, DCE security, name-based, and randomly generated UUIDs.

就可能性而言,是的,2 台设备有可能使用相同的 UUID。你可以通过其他方式做到这一点。例如

1) Get the UUID first and appened date time with it that will make completely unique id

2)Get the UUID first and appened date time and also append IMEI nuber with it that will make completely unique id

有关 UUID 的更多信息,您可以参考下面 link

http://tools.ietf.org/rfc/rfc4122.txt