0

I am building mobile apps for iOS, Android and Blackberry, Here's how I do this

  1. I build an app using jQuery, HTML5.
  2. Make a Zip file of that package.
  3. Using http://build.phonegap.com I build that app created in jQuery, HTML5 and that phonegap interface provide me build package for every device i.e. iOS, Android and Blackberry.

So this way I just have to create one app and phonegap gives me that app's package for different devices every thing is good but now I am stuck in a problem, I want to identify each device on which my app is installed uniquely but of course solution have to be global I mean I should not write different code for different platforms and devices as far as possible and solution should be using only jQuery, HTML5.

Thanx in advance.

yogi
  • 19,175
  • 13
  • 62
  • 92

2 Answers2

1

device.uuid, gives you something like that but as the docs says

Not a reliable value

http://docs.phonegap.com/en/2.2.0/cordova_device_device.md.html#device.uuid

Maybe you can store a GUID, Pseudo-Random Number or something generated at install time... (i really mean, the first time you run the app)

UPDATE: JS Pseudo-Random Number Implementation: Create GUID / UUID in JavaScript?

Community
  • 1
  • 1
JOBG
  • 4,544
  • 4
  • 26
  • 47
  • It's "Not a reliable value" because on IOS it will give you an application guid that's per phone/application. I think the device.uuid could still be a valid approach. Has anyone tried using the device.uuid for device tracking? – RayLoveless Jun 12 '14 at 21:59
0

Have you looked at the device object provided by cordova? http://docs.phonegap.com/en/2.2.0/cordova_device_device.md.html#Device

You should be able to determine what platform your app is running on at runtime.

brimil01
  • 705
  • 5
  • 6
  • cordova provides UUID which is not unique, see this http://forum.jquery.com/topic/how-to-get-mobile-imei-code and I have tested it too. – yogi Nov 20 '12 at 17:12