Reputation: 167
I tried the phonegap contacts api navigator.contacts.find()
Contacts. length is showing 100+, but when all the object values are null except id and rowid
{
"id": "1654",
"rawId": "1652",
"displayName": null,
"name": null,
"nickname": null,
"phoneNumbers": null,
"emails": null,
"addresses": null,
"ims": null,
"organizations": null,
"birthday": null,
"note": null,
"photos": null,
"categories": null,
"urls": null
},
{
"id": "1656",
"rawId": "1653",
"displayName": null,
"name": null,
"nickname": null,
"phoneNumbers": null,
"emails": null,
"addresses": null,
"ims": null,
"organizations": null,
"birthday": null,
"note": null,
"photos": null,
"categories": null,
"urls": null
},
...
My code is
var options = new ContactFindOptions();
options.filter = "";
options.multiple = true;
options.desiredFields = [navigator.contacts.fieldType.id];
options.hasPhoneNumber = true;
//var fields = [navigator.contacts.fieldType.displayName,
navigator.contacts.fieldType.name];
var fields = ["*"];
navigator.contacts.find(fields, onSuccess, onError, options);
I'm new to phonegap, anyone help?
Upvotes: 0
Views: 184
Reputation: 1
Set :
options.hasPhoneNumber = true;
Then that should not be any issue.
Upvotes: 0
Reputation: 91
please comment out this line:
//options.desiredFields = [navigator.contacts.fieldType.id];
here you specify that the results should only contain ids/rawIds
Upvotes: 2