device.uuid未定义在PhoneGap的Andr​​oid上? [英] device.uuid undefined in PhoneGap on Android?

查看:190
本文介绍了device.uuid未定义在PhoneGap的Andr​​oid上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写将请求发送到一个中央数据库的PhoneGap应用程序。它需要能够识别连接到它的唯一的装置。

I'm writing a PhoneGap application that sends requests to a central database. It needs to be able to identify the unique devices that connect to it.

的PhoneGap的 device.uuid 属性似乎做招。关于webOS的和iPhone,我回来的字母数字字符,这将满足我的需要一个唯一的字符串。然而,Android设备我测试过(摩托罗拉Droid和Android SDK模拟器,无论是运行Android 2.1)返回未定义作为 device.uuid

PhoneGap's device.uuid property would seem to do the trick. On webOS and iPhone, I get back a unique string of alphanumeric characters, which will satisfy my need. However, the Android devices I've tested (Motorola Droid and the Android SDK emulator, both running Android 2.1) return "undefined" as the device.uuid.

device.platform device.name 在所有三个平台返回正确的价值观,所以问题不有与设备做对象本身(它在我使用它code块定义)。

device.platform and device.name return correct values on all three platforms, so the problem doesn't have to do with the device object itself (it's defined in the code blocks where I use it).

这是一个Android的限制?与PhoneGap的一个问题?

Is this an Android limitation? A problem with PhoneGap?

是否有任何其他的方式来获得这样一个全局唯一标识符如果不通过 device.uuid

Is there any other way to get such a globally unique identifier if not through device.uuid?

编辑:看来, deviceready 事件永远不会被解雇,这需要在 device.uuid 属性变为可用。

It appears that the deviceready event is never getting fired, which needs to happen before the device.uuid property becomes available.

推荐答案

我还没有找到一个解决方案,但值得注意的是,这一问题已在Android 2.2的。但除此之外,你将不得不如果设备运行的是2.1找得到一个唯一的设备标识符的​​一些其他的方式或更早版本。

I haven't yet found a solution for this, but it is worth noting that this issue is fixed in Android 2.2. But other than that, you'll have to find some other way of getting a unique device identifier if the device is running 2.1 or earlier.

这篇关于device.uuid未定义在PhoneGap的Andr​​oid上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆