简体   繁体   English

如何在PHONEGAP上获取设备uuid

[英]How get Device uuid on PHONEGAP

I see any examples of this, but all of than use the "device ready", I really need to use this event or I can get the device uuid out of this event? 我看到了任何这样的示例,但是除了使用“设备就绪”之外,我真的需要使用此事件,还是可以从该事件中获取设备uuid?

When I tested this on my browser I got the gap of device uuid, but on device this don't show me anything. 当我在浏览器上进行测试时,我发现了设备uuid的不足之处,但是在设备上却没有显示任何内容。

Anyone Can show me an example? 任何人都可以举个例子吗?

Install the Device plugin as explained here: https://github.com/apache/cordova-plugin-device 按照以下说明安装设备插件: https : //github.com/apache/cordova-plugin-device

Then in your Javascript call device.uuid . 然后在您的Javascript中调用device.uuid

There is this plugin cordova device which is able to get the device uuid. 有这个插件cordova设备 ,可以获取设备uuid。 As always plugins can only be used after the device ready event was fired. 与往常一样,只有在设备就绪事件触发后才能使用插件。

Example: 例:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM