How to get activate the camera and take a picture?
Hello all,
I have a question about the camera and calling the Phonegap API directly. I was following the tutorial on this site about using the camera and have had no luck getting it to work. I click the button that should open the camera application but nothing happens. Thinking it was possible the tutorial was out of date, I went over to the phonegap api documents and tried their example. I get the same result (i.e. nothing happens).
Here is my setup:
I have a simple button with a click event which calls this function:
function capturePhoto() {
// Take picture using device camera and retrieve image as base64-encoded string
alert("clicked button");
navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50 });
}
For testing I put the alert into the function to be sure the function was called. I also put an alert in the "onPhotoDataSuccess" function, however that function was never called. I have a feeling that calling the native phonegap api needs to be done differently, but I am not sure how.
Any thoughts?