Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »


5.0.0 • Public • Published

title: Android Photo description: Take photos with the camera on Android.

Travis CI
Build Status


This plugin defines a global navigator.photo object, which provides an API for taking photos with the camera on Android.

Although the object is attached to the global scoped navigator, it is not available until after the deviceready event.

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

Supported Platforms

  • Android


cordova plugin add cordova-plugin-android-photo

It is also possible to install via repo url directly (unstable)

cordova plugin add https://github.com/shaunjohansen/cordova-plugin-android-photo.git

How to Contribute

Contributors are welcome! You can report bugs, improve the documentation, or contribute code.

And don't forget to test and document your code.

API Reference


photo.takePicture(successCallback, errorCallback)

Takes a photo using the camera. The image is passed to the success callback as the URI for the image file.

The photo.takePicture function opens the device's default camera application which allows users to snap a photo. Once the user snaps the photo, the camera application closes and the application is restored.

The image file location is sent to the successCallback callback function.

Kind: static method of camera

Param Type
successCallback successCallback
errorCallback errorCallback


navigator.photo.takePicture(successCallback, errorCallback);

Android Quirks

Android uses intents to launch the camera activity on the device to capture images, and on phones with low memory, the Cordova activity may be killed. In this scenario, the result from the plugin call will be delivered via the resume event. See the Android Lifecycle guide for more information. The pendingResult.result value will contain the value that would be passed to the callbacks (either the URI/URL or an error message). Check the pendingResult.pluginStatus to determine whether or not the call was successful.

camera.errorCallback : function

Callback function that provides an error message.

Kind: static typedef of camera

Param Type Description
message string The message is provided by the device's native code.

camera.successCallback : function

Callback function that provides the image uri.

Kind: static typedef of camera

Param Type Description
imageUri string The image file URI.


// Show image
function cameraCallback(imageUri) {
   var image = document.getElementById('myImage');
   image.src = imageUri;

Big Thanks

  • Cross-browser testing platform and open source <3 provided by Sauce Labs


npm i cordova-plugin-android-photo

Downloadsweekly downloads










last publish


  • avatar
Report a vulnerability