UserXYZ
UserXYZ

Reputation: 223

Generating Unique ID for phone (without using UDID)

I need to generate a unique ID for phones (to be able to identify the user) but do not want to use the UDID due to the lack of future support (in Iphone 5, etc). I am using Phonegap for my applications. Is there a good way to generate "random" ID based on phone name / hardware / etc? I believe there is a JS function that could do something like this but I am not sure and hence seek clarification.

Thanks!

Upvotes: 3

Views: 1310

Answers (3)

Jack Humphries
Jack Humphries

Reputation: 13267

Apple has something called CFUDID (or similar to that, can't remember the exact name) that will generate a unique ID based on a few different factors. I would check out the documentation for that.

Upvotes: 1

Venky
Venky

Reputation: 559

You can create unique and random string using CFUUIDCreate function which will be very much random.

Upvotes: 2

Suhail Patel
Suhail Patel

Reputation: 13694

Someone has released a UUID alternative which you could use in iOS5 (linked below) which generates a token based on the Mac Address. You could make use of the Plugin System in Phonegap to run this Objective-C Code and then return the new token in to your Javascript Code

Github Project - UIDevice-with-UniqueIdentifier-for-iOS-5: https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5

Edit: For other devices such as Blackberry and Android, you could just use the device.uuid call available in Phonegap. This is explained in the Device Section of the PhoneGap Documentation

Upvotes: 3

Related Questions