O'Reilly logo

PhoneGap By Example by Andrey Kovalenko

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

Using a camera to capture pictures

Now, we would like to take pictures with a camera inside our application, attach a caption to it, and save it for future usage. First of all, let's install the Cordova plugin to access the camera.

Camera plugin installation

To install the plugin, simply run this command:

$ cordova plugin add org.apache.cordova.camera

The execution of the command will take a while. At the end of the flow, you will see the following messages:

Installing "org.apache.cordova.camera" for android
Installing "org.apache.cordova.camera" for ios

Now, we have this plugin installed for both iOS and Android platforms.

Tip

The Cordova Camera plugin supports Amazon Fire OS, Android, BlackBerry 10 browser, Firefox OS, iOS, Tizen, Windows Phone ...

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