结果
- 它总是停在"APACHE CORDOVA连接到设备">
- 我不知道为什么
我的步骤
- 1.npm安装-gd cordova
- 2.科多瓦创造myapp
- 3.cd myapp
- 4.cordova平台添加android
- 5.cordova插件添加https://github.com/InQBarna/WebIntent.git
- 6.cordova运行android
这是我的index.js的一部分:
receivedEvent: function(id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
document.onclick = function() {
CDV.WEBINTENT.startActivity({
action: CDV.WEBINTENT.ACTION_VIEW,
url: 'geo:0,0?q=' + 'new york'
},
function() {}, function() {
alert('Failed to open URL via Android Intent')
})
}
}
您的代码中有多个},
和;
。
receivedEvent: function(id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
console.log('Received Event: ' + id);
//I just try to launch a map view app.
document.onclick = function() {
alert(new Date);
CDV.WEBINTENT.startActivity({
action: CDV.WEBINTENT.ACTION_VIEW,
url: 'geo:0,0?q=' + 'new york'
}, function() {}, function() {
alert('Failed to open URL via Android Intent')
});
}
}