Book Image

PhoneGap Beginners Guide (third edition)

Book Image

PhoneGap Beginners Guide (third edition)

Overview of this book

Table of Contents (22 chapters)
PhoneGap Beginner's Guide Third Edition
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Related Plugin Resources
Index

The Contacts API


You can easily access the contact information stored on a device using the PhoneGap API. The Contacts API is an implementation of the W3C's Pick Contacts Intent API (an intent that enables access to a user's address book service from inside a web application). You can read more about the W3C specifications at http://www.w3.org/TR/contacts-api/.

The required functionalities of the Contacts API are provided by the Contacts plugin identified by the name cordova-plugin-contacts. This plugin supports major platforms.

For a complete list of all the supported platforms, refer to the documentation at http://docs.phonegap.com/en/edge/cordova_contacts_contacts.md.html#Contacts.

In order to start the interaction with the device contacts, you can use the create or find methods defined in the contacts object stored in the navigator object:

var contact = navigator.contacts.create(properties);
navigator.contacts.find(contactFields, contactSuccess, contactError, contactFindOptions);

In order...