在 Phonegap android 中,出厂重置时 UUID 是否更改

Does UUID change when factory reset, in Phonegap android

我依靠 device.uuid 来控制我的用户,在 Phonegap android.

中恢复出厂设置后 UUID 会改变吗

如果您谈论的是 android 的设备 UUID,它是在设备首次启动时生成的随机 ID。它将保持不变,直到 OS 升级或恢复出厂设置。因此,您可以将该 ID 用作您应用中设备的唯一标识符。这样,用户甚至不需要登录您的应用程序。只需打开它自己,您就可以获得一个唯一的(几乎)标识符,您可以使用它。

更新

根据docs

A 64-bit number (as a hex string) that is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device. The value may change if a factory reset is performed on the device.

更新 2

来自 android 开发人员的有用文章 Identifying App Installations and Best Practices for Unique Identifiers

更新新信息:

在Android 8.0(API 26 级)和更高版本的平台上,一个 64 位数字(表示为十六进制字符串),对于每个应用签名密钥组合都是唯一的、用户和设备。 ANDROID_ID 的值由签名密钥和用户限定范围。如果在设备上执行出厂重置或 APK 签名密钥更改,则该值可能会更改。有关平台如何处理 Android 8.0(API 级别 26)及更高版本中的 ANDROID_ID 的更多信息,请参阅 Android 8.0 行为更改。

注意:对于在将设备更新到 Android 8.0(API 级别 26)或更高版本之前安装的应用程序,如果应用程序被卸载,然后在 OTA 后重新安装。要在 OTA 到 Android 8.0 或更高版本后保留卸载值,开发人员可以使用 Key/Value 备份。

旧答案

device.uuid 在 android 上获得原生 android.provider.Settings.Secure.ANDROID_ID

根据to the docs

A 64-bit number (as a hex string) that is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device. The value may change if a factory reset is performed on the device.

Note: When a device has multiple users (available on certain devices running Android 4.2 or higher), each user appears as a completely separate device, so the ANDROID_ID value is unique to each user.

是的,如果用户恢复出厂设置,该值可能会改变。