Book Image

Phonegap Essentials

By : Ivan Turkovic
Book Image

Phonegap Essentials

By: Ivan Turkovic

Overview of this book

Table of Contents (15 chapters)


The Contacts plugin is one of the most useful features if you are trying to build an application for a social platform. It can have advantages when it comes to making a decision about native applications; many other features are available for web applications directly through HTML5 technologies, and this one requires PhoneGap to make it work.

To install the plugin, you need to run the following command:

phonegap plugin add cordova-plugin-contacts

With this plugin, you need to run examples on the physical device since the simulator does not provide data for it.

This plugin defines a global navigator.contacts object that provides access to the device contacts; it is available after the deviceready event has been fired:

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {

The Contacts plugin has the following methods:

  • navigator.contacts.create

  • navigator.contacts.find

  • navigator.contacts.pickContact