How to use PhoneGap to find contacts

Xiaobian to share with the use of PhoneGap to find contacts, I believe that most people don’t know much, so share this article to everyone, I hope everyone has a big gain after reading this article. Let’s take a look!

    Database Example     document.addEventListener ( "deviceready", onDeviceReady, false); function onDeviceReady () {} function onSuccess (contacts) {document.write (contacts.length + 'contacts found.'); for (var i = 0; I   Find Contact  <contacts.length;i++){ 
                    for(var j=0;j<contacts[i].emails.length;j++){ 
                        document.write("Email="+contacts[i].emails[j].email); 
                    } 
                } 
                alert('success'); 
            } 
              
            function onError(error){ 
                 alert("Ooops!"); 
            } 
              
            function findContact(){ 
                var myOptions=new ContactFindOptions(); 
                myOptions.filter="gmail";//过滤 
                var myFields=["emails"];//要查询的字段 
                navigator.contacts.find(myFields,onSuccess,onError,myOptions); 
            } 
              
                                
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment