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 7 and 8, and Windows 8 platforms.
This plugin defines a global navigator, a camera object, that provides an API to take pictures and choose images from the system's image library. Let's look at it using an example.
Camera plugin usage
Let's go to our Travelly...