I am attempting to retrieve the contacts stored on a mobile device. The code snippet I am using is not functioning as expected - specifically, the navigator.contacts.find method isn't producing any outcomes. There are no error messages or success confirmations. Additionally, adding an alert message after that particular line of code does not display anything.
function extract_contacts(){
var options = new ContactFindOptions();
options.filter = ""; //if left empty, all contacts will be returned
options.multiple = true; //multiple results will be returned
var filter = ["displayName"]; //an array used to compare against the options.filter
navigator.contacts.find(filter, successFunction, errorCallback, options); //issue arises here
function successFunction( matches ){
alert("Collecting contact information...");
for( var i=0; i<matches.length; i++){
alert(matches[i].displayName);
}
}
function errorCallback(){
alert("Unable to find contacts.");
}
}