Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cordova 如何从GitHub上的PhoneGap开始?_Cordova_Github_Phonegap Build - Fatal编程技术网

Cordova 如何从GitHub上的PhoneGap开始?

Cordova 如何从GitHub上的PhoneGap开始?,cordova,github,phonegap-build,Cordova,Github,Phonegap Build,我想开始使用PhoneGap。我在中创建了项目,并使用。当我将其下载到我的android设备时,ondevicerady()不会被触发。我错过什么了吗 在index.html中,将JavaScript代码从标题移到html正文中 <html> <head> <title>Contact Example</title> <script type="text/javascript" src="phoneGap.js">&

我想开始使用PhoneGap。我在中创建了项目,并使用。当我将其下载到我的android设备时,
ondevicerady()
不会被触发。我错过什么了吗

在index.html中,将JavaScript代码从标题移到html正文中

<html>
  <head>
    <title>Contact Example</title>
    <script type="text/javascript" src="phoneGap.js"></script>

  </head>
  <body>
    <h1>Example</h1>
    <p>Find Contacts</p>

     <script type="text/javascript" >

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

    // Cordova is ready
    //
    function onDeviceReady() {
        // find all contacts with 'Bob' in any name field
        var options = new ContactFindOptions();
        options.filter="Bob"; 
        var fields = ["displayName", "name"];
        navigator.contacts.find(fields, onSuccess, onError, options);
    }

    // onSuccess: Get a snapshot of the current contacts
    //
    function onSuccess(contacts) {
        for (var i=0; i<contacts.length; i++) {
            console.log("Display Name = " + contacts[i].displayName);
        }
    }

    // onError: Failed to get the contacts
    //
    function onError(contactError) {
        alert('onError!');
    }

    </script>
  </body>
</html>

联系方式
例子
查找联系人

文件。添加的监听器(“deviceready”,OnDeviceraddy,false); //科尔多瓦准备好了 // 函数ondevicerady(){ //在任何姓名字段中查找与“Bob”的所有联系人 var options=new ContactFindOptions(); options.filter=“Bob”; 变量字段=[“显示名称”,“名称”]; navigator.contacts.find(字段、onSuccess、onError、选项); } //onSuccess:获取当前联系人的快照 // 成功时的功能(联系人){
对于(var i=0;i,在使用PGB时,项目中不包括phonegap.js文件

我知道这听起来很奇怪,但是你调用JS,PGB会在构建时根据每个平台自动添加它

基于index.html文件中的调用