我對Cordova/Phonetgap設備API有問題,未找到objetc設備。我做回調device.model或設備和任何回報的fecture:Phonegap/Cordova設備API在Android上未定義
的ReferenceError:找不到變量:設備在文件:///android_asset/www/index.html:16
我下面這個步驟:http://cordova.apache.org/docs/en/3.3.0/cordova_device_device.md.html#Device firts創建科爾多瓦Android項目,後來我通過安裝插件的設備:「科爾多瓦插件添加org.apache.cordova.device」我這個index.html的測試:
<!DOCTYPE html>
<html>
<head>
<title>Device Properties Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// device APIs are available
//
function onDeviceReady() {
var string = device.platform;
var element = document.getElementById('deviceProperties');
element.innerHTML = string;
}
</script>
</head>
<body>
<p id="deviceProperties">Loading device properties...</p>
</body>
</html>
我有在app/res/xml/config.xml中這行:
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />
</feature>
在這裏有更多的細節截圖: https://dl.dropboxusercontent.com/u/6404856/Helpme.JPG
是啊!!!!它現在在工作!非常感謝!!!插件插件安裝完成後,我沒有做android。尼斯:D – johanjmoncada