如何从Jquery,HTML5 Mobile应用程序获取唯一设备ID [英] How to get Unique Device Id from a Jquery, HTML5 Mobile app
问题描述
我正在为iOS,Android和Blackberry构建移动应用程序。
I am building mobile apps for iOS, Android and Blackberry, Here's how I do this
- 我使用jQuery,HTML5
- 使用 http://build.phonegap.com 我创建的应用程序创建在jQuery,HTML5和phonegap界面提供我的构建包为每个设备,即iOS,Android和黑莓。
- I build an app using jQuery, HTML5.
- Make a Zip file of that package.
- 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.
所以这种方式我只需要创建一个应用程序,phonegap给我的应用程序的包为不同的设备每一件事情都很好,但现在我陷入了一个问题,我想要识别我的应用程序安装在其上的每个设备唯一,但当然解决方案必须是全球的我的意思是我不应该为不同的平台和设备尽可能编写不同的代码,解决方案应该只使用jQuery,HTML5。
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。
推荐答案
device.uuid
,给你这样的东西,但正如文档所说
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
也许你可以存储GUID,伪随机数或在安装时生成的东西...(我真的是,第一次运行应用程序时)
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伪随机数实现:
如何在Javascript中创建GUID / UUID?
这篇关于如何从Jquery,HTML5 Mobile应用程序获取唯一设备ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!