如何使用Phonegap获取设备标识符 [英] How to get a device identifier using Phonegap

查看:155
本文介绍了如何使用Phonegap获取设备标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要获取任何数字,序列号,密钥或其他任何标识运行我的phonegap应用程序的每个设备,我认为 uuid 也会更改时,应用程序更新,因此它不会为我工作。

I need to get any number, serial, key or whatever to identify every device where my phonegap app is running, I think uuid also changes when the app updates so it wouldn't work for me.

这里的情况是用户可以同步应用程序的数据,因此我需要知道哪个设备已同步,哪些设备没有同步,或者需要更新新的可能其他设备已经完成的数据等。

The scenario here is that the user can synchronize data from the app, so I need to know which device has synchronized and which has not, or if it needs to update new data that maybe others devices have already done, etc

任何想法?

推荐答案

<script type="text/javascript" charset="utf-8">

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
    var element = document.getElementById('deviceProperties');
    element.innerHTML = 'Device Model: '    + device.model    + '<br />' +
                        'Device Cordova: '  + device.cordova  + '<br />' +
                        'Device Platform: ' + device.platform + '<br />' +
                        'Device UUID: '     + device.uuid     + '<br />' +
                        'Device Version: '  + device.version  + '<br />';
}

</script>

获取设备信息后,您可以将逻辑应用于验证。

After getting the device info you can apply your logic to validation.

参考: http://docs.phonegap.com/en /3.2.0/cordova_device_device.md.html#Device

这篇关于如何使用Phonegap获取设备标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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