npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-android-photo

v5.0.0

Published

Cordova Android Photo Plugin

Downloads

4

Readme


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

|Travis CI| |:-:| |Build Status|

cordova-plugin-android-photo

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() {
    console.log(navigator.photo);
}

Supported Platforms

  • Android

Installation

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


camera

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 |

Example

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

Example

// 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