2015-11-25 34 views
0

我看到这方面的任何例子,但使用“设备准备好”,我真的需要使用这个事件,或者我可以让设备uuid出这个事件吗?如何在PHONEGAP上获取设备uuid

当我在浏览器上测试这个时,我得到了设备uuid的空白,但是在设备上这并没有显示任何东西。

任何人都可以告诉我一个例子吗?在你的JavaScript调用device.uuidhttps://github.com/apache/cordova-plugin-device

然后:

+0

的可能的复制[如何获得使用PhoneGap的设备标识符(http://stackoverflow.com/questions/20359655/how-to-get-a-device-identifier-使用手机版) –

回答

1

有这个plugin cordova device这是能够得到设备uuid。 一如既往只能在设备就绪事件被触发后才能使用插件。

实施例:

document.addEventListener("deviceready", onDeviceReady, false); 
function onDeviceReady() { 
    console.log(device.uuid); 
} 
+0

感谢您的重新申请和解释 –

1

安装设备插件,为这里解释。

+0

感谢您的重新申请和解释 –

+0

@MarcosHenrique乐于帮助! – camelCaseCoder