Android/Cordova UUID 可靠性

Android/Cordova UUID reliability

我正在开发依赖于设备 UUID 的 Apache Cordova 应用程序。我脑子里有几个问题 运行,但不幸的是,我似乎无法在任何地方找到答案。

在 android 它使用 android.provider.Settings.Secure.ANDROID_ID

public static final String ANDROID_ID Added in API level 3

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.

它可以在根设备上更改。 http://www.prophethacker.com/2014/08/how-change-your-android-mobile-device-id.html

在 iOS 上,cordova 在第一个 运行 上创建一个随机字符串,该字符串仅对您的应用程序是唯一的,甚至可能在应用程序更新时发生变化。

iOS Quirk

The uuid on iOS is not unique to a device, but varies for each application, for each installation. It changes if you delete and re-install the app, and possibly also when you upgrade iOS, or even upgrade the app per version (apparent in iOS 5.1). The uuid is not a reliable value.

在 iOS 您可以将我的标识符用于供应商插件 https://github.com/jcesarmobile/IDFVPlugin

它使用供应商的本地标识符 https://developer.apple.com/library/ios/documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html#//apple_ref/occ/instp/UIDevice/identifierForVendor