Developers can access, read from, and filter the contacts saved within the device's contact database, allowing them to query and work with the address book on the device.
We will create an application to read all contacts in the device database and output them as a list:
Firstly, create a new PhoneGap project named
readcontact
by running the following command:phonegap create readcontact com.myapp.readcontact readcontact
Add the devices platform. You can choose to use Android, iOS, or both:
cordova platform add ios cordova platform add android
Add the contact plugins by running this command:
cordova plugin add org.apache.cordova.contacts
Open
www/index.html
, and let's clean up the unnecessary elements. We will be using jQuery Mobile, so we have to make a reference:<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="format-detection" content="telephone=no" /> <meta name...