I’m trying to access the phone contact list, and for the life of me, I can’t seem to get the navigation.contacts to actually have a value. Here’s the code I’m working with inside of my controller:
$ionicPlatform.ready(function () {
// called when ready
alert(“Device ready”);
function get_contacts() {
var obj = new ContactFindOptions();
obj.filter = "";
obj.multiple = true;
console.log("navigator.contacts: " + navigator.contacts);
navigator.contacts.find(["displayName", "name", "phoneNumbers"], contacts_success, contacts_fail, obj);
}
function contacts_success(contacts) {
console.log("contacts_success(): " + JSON.stringify(contacts));
}
function contacts_fail(msg) {
console.log("get_contacts() Error: " + msg);
}
get_contacts();
});
The latest error I’m getting is that ContactFindOptions is not defined. I’ve installed the org.apache.cordova.contacts.ContactManager plugin, but still can’t seem to get anything. Anyone have any advice???