O'Reilly logo

PhoneGap Essentials by Ivan Turkovic

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Contacts

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", ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required