Hi Jose,

On 07/28/2013 06:01 PM, jose llopis wrote:
thats my problem. i use this code and only get null

Just to clarify, are you seeing "null" in your alert dialog for each contact?

Are you able to view the email address in the stock contacts app?

var allContacts = navigator.mozContacts.getAll({});
     allContacts.onsuccess = function(event) {
       var cursor = event.target;
       if (cursor.result) {
                 if(cursor.result['tel']!=null)
                 {
                     $("#res").append((cursor.result['givenName']+" " 
+cursor.result['familyName']+"<br/>"));
                     for(i=0;i<cursor.result['tel'].length;i++)
                     {
                         $("#res").append("telf: 
"+(cursor.result['tel'][i].value)+"<br/>");
                     }
                     alert(cursor.result['email']);
                 }
         cursor.continue();
       } else {
         alert("No more contacts");
       }
     }

Also, be aware that givenName, familyName, and email are also arrays just like the tel field.

Thanks.

Ben
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to