The Camera API is what permits us to capture images and to access the user's saved photo library. While we'll cover a lot of the API in this task, if you want to see the most up-to-date documentation for it, visit https://github.com/apache/cordova-plugin-camera/blob/dev/doc/index.md.
Before continuing, be sure to add the camera plugin to your project:
cordova plugin add org.apache.cordova.camera
Taking a picture is easy, especially when compared with prior APIs we've dealt with. You can simply use this:
navigator.camera.getPicture ( success, error [, options] );
The Camera API will then open in the device and the user can take a picture. Once they are done and approve the picture as taken, the success
function will be called with the image. If an error occurs (or the user rejects the image), the error
function will be called.
The options
parameter is a dictionary that consists of several properties that control the image source (the camera...