为什么带有webintent插件的Cordova对我不起作用?

时间:2014-06-06 00:13:49

标签: cordova cordova-3 webintents

结果

  • 它总是停在" APACHE CORDOVA连接到设备"
  • 我不知道为什么......

我的步骤

这是我的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')
        })
    }
}

1 个答案:

答案 0 :(得分:0)

您的代码中有多个},;

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')
        });
    }
}