Phonegap-检测仿真 [英] Phonegap - Detect emulation
本文介绍了Phonegap-检测仿真的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Phonegap APP如何能够确定它是在实际设备上运行还是在仿真设备上运行?我需要一个适用于Android和iOS的解决方案.
How would a Phonegap APP be able to determine if it was running on an actual device as opposed to an emulated device? I need a solution that works for both Android and iOS.
推荐答案
您是否看过设备API 在Cordova的网站上?您可以使用log device.model或device.name来获得所需的结果.
Did you take a look at Device API on Cordova's website? You can use log the device.model or device.name in order to acheive the desired results.
// device APIs are available
//
function onDeviceReady() {
var element = document.getElementById('deviceProperties');
element.innerHTML = 'Device Name: ' + device.name + '<br />' +
'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 />';
}
这篇关于Phonegap-检测仿真的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文