How t开发者_高级运维o get iPhone's Unique Identifier (UDID) using Phonegap ? Any code ?
You cannot get UDID from phonegap API as of now.
Why?
UDID is unique identifier for iOS devices and this is not there in other platforms such as Android, Windows etc. And hence phonegap cannot provide udid as its supposed to support all platforms.
Solution :
Phonegap API provides another unique identifier called uuid
. This will be unique for each installation of the application.
Drawback : This unique key is a system generated one which is generated on each App boot(first launch of application). And hence you cannot determine the device properly. Uninstalling an application and installing it back again will regenerate a different udid.
URL : http://docs.phonegap.com/en/1.0.0/phonegap_device_device.md.html#device.uuid
Hope this makes sense.
UUID (Universally Unique IDentifier) Is on a per-app basis. identifies an app on a device. As long as the user doesn’t completely delete the app, then this identifier will persist between app launches, and at least let you identify the same user using a particular app on a device. Unfortunately, if the user completely deletes and then reinstalls the app then the ID will change.
UDID (Unique Device Identifier) A sequence of 40 hexadecimal characters that uniquely identify an ios device. This value can be retrieved through iTunes, or found using UIDevice -uniqueIdentifier. Derived from hardware details like MAC address.
var string = device.uuid;
PhoneGap api docs are here if you need any more info... http://docs.phonegap.com/phonegap_device_device.md.html#device.uuid
精彩评论