I’ve been trying to find a sample code how to open the contact list from phone. I have an form with an input and when it’s submitted I want an event that opens the contact list so I can select a contact from my phone.
Any ideas?
Much appreciated
I’ve been trying to find a sample code how to open the contact list from phone. I have an form with an input and when it’s submitted I want an event that opens the contact list so I can select a contact from my phone.
Any ideas?
Much appreciated
You will need to use this plugin: https://www.npmjs.com/package/cordova-plugin-contacts to access the contact information on the device.
I found out that I can use the pickContact() method from cordova-plugin-contacts to open the contact list in my phone.
But now when I select a contact from the list, the screen goes all white and doesn’t display the alert in the promise.
(I’m on IOS and viewing the app in Ionic View, maybe this doesn’t happen on a physical device?)
Here is the code to pick a contact
submitForm() {
let contactsfound
Contacts.pickContact().then((contacts) => {
alert("INSIDE PROMISE")
contactsfound = contacts;
})
if (contactsfound.length == 0)
alert('No Contacts found');
}
Best regards
Any ideas for the white screen of death?
Have tried to debug this in a android phone, when a contact is selected from the list the app redirects me to the root page.
Help appreciated
Best regards
Any updates on this!.. I want to view all contacts and be able to select in order send an invitation
Your app crashed because it attempted to access “privacy-sensitive data” without a usage description. You should add Contacts Usage Description (why you need to access it) in your Info.plist file.
So just go to Info.plist, and add this :
<key>NSContactsUsageDescription</key>
<string>here I to need to access the contact....</string>