How to get iPhone's Unique Identifier (UDID) using Phonegap? - iphone

How to 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

Related

Could use identifierforvendor as identifier?

follow this document. identifierforvendor is unique on the same app on the same device.
I want to ask. Is identifierforvendor unique each device?
https://developer.apple.com/reference/uikit/uidevice/1620059-identifierforvendor
Yes.
UUID is unique for each device for your applicaion. But it will be changed if user uninstalls your application. So lets say User installed your application and you get their UUID and it was abc123 or something. Now If they un-install an re-install your application. You will not get the same UUID as before. If you want to use UUID for identifying the user. Detecting whether this user previously installed your application or not requires you to use keychain.

Is there any way to retrieve the UUID of an iPhone using Titanium?

The API documentations says that Titanium.Platform.getId() returns the UDID (unique device ID) for android but for iOS this is a unique identifier for a particular installation of the application. It also says that Apple has restricted the access to UUID.
However, if I need to retrieve a unique device ID for an iPhone, is there any way to do it? Or is it not possible at all?
There is no way to get any device unique identifiers in iOS 7 and up, Apple has restricted this due to privacy concerns. The trick to use the MAC address is also no longer working.
You options are the identifier for vender (the one Titanium.Platform.getId() returns).
This one is unique for the device as long as there is app on the device from the same developer.
Another option is to create a unique identifier and save it in the keychain, this way it will be saved there until the user full wipes it's iOS device.
No, you can't. Check this article for some more informations:
http://www.doubleencore.com/2013/04/unique-identifiers/

iOS Unique Identifier

How are we supposed to uniquely identify devices now that the UDID has been deprecated? I need to be able to uniquely identify a device even if the user uninstalls my app and then reinstall it. The new identifierForVendor doesn't work for this purpose because it will randomly generate again once the user uninstalls the app. I also can't use the MAC address to identify the device because it doesn't work in iOS 7.
The advertisingIdentifier seems to work for my purposes but I heard that if you're not actually using it for advertising Apple will reject your app?
Does anyone know of a way to reliably identify a device?
According to Apple, you should be using the vendor or advertising identifiers. Vendor doesn't work for you obviously, but you are fine to use advertisingIdentifier.
The advertisingIdentifier seems to work for my purposes but I heard that if you're not actually using it for advertising Apple will reject your app?
They are not currently rejecting apps for using avertisingIdentifier in place of uniqueIdentifier as a device ID. I just had a version of my app approved that uses advertisingIdentifier for purposes other than advertising. A bigger negative is that users can change this identifier any time they like, which is guaranteed to mess up your reporting.

Is it possible to bundle a unique file for each copy of iPhone app downloaded from App Store?

I would like to verify the identity of each instance of the iPhone application that a user might use to connect to my service. To that end, I would like each instance of the iPhone app downloaded to include a certificate that I generate, or even some sort of UUID that I have generated. Does the App Store support the inclusion of unique files in an app bundle?
Or, must such identifiers be downloaded only after the app is installed? If that is the case, is there a mechanism to ensure that the app downloaded is trusted (from me), instead of from an impersonator?
I don't think it's possible to have unique packages per download. Why don't you use the UUID of the device for such checks?

Do I need a UUID to program for the iPhone?

Do I need a UUID to program for the iPhone? I was told I need this, how can I get a UUID
You need a developer certificate from Apple to install your application on an actual iPhone and to post your application to the Apple Store but you don't need a uuid unless the person mistook developer certificate for uuid and used the wrong term. To get the certificate you have to join Apple's developer program.
UUID, Universally Unique ID number, or also called UDID, Unique Device ID number, is part of the certification used to sign an application's code to one or more devices.
It is necessary to be able to transfer your application to your iPhone (or iPod Touch) for testing and for Ad Hoc Distribution. You need to enter (and pay $99) Apple's iPhone Developer's Program (individual or company) to get the certificate that enables you to do this. It is common for a developer to request beta testers to provide their UUID's so that the developer can create the certificate/provisioning file which allows the application to work.
The UUID can be found in iTunes when you have your iPhone connected. On the Summary tab, click on "Serial Number" and it should change to "Identifier". The resulting 40 digit hex number can be copied to the clipboard by pressing Command-C (Mac) or CTRL-C (Windows).
Alternatively, you can download Ad Hoc Helper app from the iTunes AppStore. When you run it, it creates an email which includes your iPhone's identifier in the body.
Note that you can download the iPhone SDK with a free account and program using the SDK's built-in iPhone simulator.