Android/Cordova UUID可靠性 [英] Android/Cordova UUID reliability

查看:72
本文介绍了Android/Cordova UUID可靠性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发依赖于设备UUID的Apache Cordova应用.我脑海中浮现出几个问题,但不幸的是,我似乎无法在任何地方找到答案.

I'm developing an Apache Cordova app that relies on the device UUID. A couple questions run through my mind but I unfortunately couldn't seem to find the answer anywhere.

  • 获得的device.uuid是否在每个平台上都一样,因为我计划同时在Android和iOS上发布它?
  • Cordova提供的UUID与操作系统相同吗?
  • 是否有任何更改/欺骗OS/Cordova UUID的方法?(这对我很重要)

推荐答案

在Android上,它使用 android.provider.Settings.Secure.ANDROID_ID

on android it uses android.provider.Settings.Secure.ANDROID_ID

在API级别3中添加的公共静态最终字符串ANDROID_ID

public static final String ANDROID_ID Added in API level 3

64位数字(以十六进制字符串形式),当用户首先设置设备,并且对于用户设备的生命周期.如果恢复出厂设置,该值可能会更改在设备上执行.

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.

注意:当一个设备有多个用户时(某些设备上可用)运行Android 4.2或更高版本),则每个用户都将显示为完全单独的设备,因此ANDROID_ID值对于每个用户都是唯一的.

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

it can be altered on root devices. http://www.prophethacker.com/2014/08/how-change-your-android-mobile-device-id.html

在iOS上,cordova在首次运行时创建一个随机字符串,该字符串仅对您的应用程序唯一,并且甚至在应用程序更新时也可能会更改.

On iOS cordova create a random string on the first run, the string is unique for your app only, and might change even on app updates.

iOS Quirk

iOS Quirk

iOS上的uuid并非设备独有,但每个设备都有所不同应用程序,用于每次安装.如果您删除和删除它,它会更改重新安装该应用程序,甚至在升级iOS甚至重新安装时升级每个版本的应用程序(在iOS 5.1中明显).uuid不是可靠的价值.

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

On iOS you can use my identifier for vendor plugin 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

It uses the native identifier for vendor https://developer.apple.com/library/ios/documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html#//apple_ref/occ/instp/UIDevice/identifierForVendor

这篇关于Android/Cordova UUID可靠性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆