Help get this topic noticed by sharing it on Twitter, Facebook, or email.

Phonegap - camera not working in Android

Hi Team,
Why i am getting Camera Object or Camera.GetPicture Object return as Undefined for Android Mobile using PhoneGap?

Please advice, if i am missing any reference to be added in application.
1 person has
this question
  • (some HTML allowed)
    How does this make you feel?
    Add Image

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned happy, confident, thankful, excited kidding, amused, unsure, silly

  • This reply was removed on 2012-08-08.
    see the change log
  • Yes Amir,this my code...

    <!DOCTYPE html>
    <title>Capture Photo</title>

    <script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"></script>
    <script type="text/javascript" charset="utf-8">

    var pictureSource; // picture source
    var destinationType; // sets the format of returned value

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

    function onDeviceReady() {
    alert("Event Fired");
    pictureSource =;
    destinationType =;

    function onPhotoDataSuccess(imageData) {

    var smallImage = document.getElementById('smallImage');

    smallImage.src = "data:image/jpeg;base64," + imageData;

    function onPhotoURISuccess(imageURI) {

    var largeImage = document.getElementById('largeImage'); = 'block';
    largeImage.src = imageURI;

    function capturePhoto() {, onFail, { quality: 50,
    destinationType: destinationType.DATA_URL

    function capturePhotoEdit() {, onFail, { quality: 20, allowEdit: true,
    destinationType: destinationType.DATA_URL

    function getPhoto(source) {, onFail, { quality: 50,
    destinationType: destinationType.FILE_URI,
    sourceType: source

    function onFail(message) {
    alert('Failed because: ' + message);

    <button onclick="capturePhoto();">Capture Photo</button> <br>
    <button onclick="capturePhotoEdit();">Capture Editable Photo</button> <br>
    <button onclick="getPhoto(pictureSource.PHOTOLIBRARY);">From Photo Library</button><br>
    <button onclick="getPhoto(pictureSource.SAVEDPHOTOALBUM);">From Photo Album</button><br>
    <img style="display:none;width:60px;height:60px;" id="smallImage" src="" />
    <img style="display:none;" id="largeImage" src="" />
  • (some HTML allowed)
    How does this make you feel?
    Add Image

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited