camera plugin on Android crashes after photo taken

  • 1
  • Question
  • Updated 6 years ago
When using the camera plugin with 3.1.0 on Android, the app crashes after photo taken. Screen goes black for long time, then i see an error that my app crashed. Same code works fine on iOS.

Any ideas?

Thanks,
Don

function captureImage1(evt) {
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
destinationType: Camera.DestinationType.DATA_URL,correctOrientation:true,allowEdit:true,saveToPhotoAlbum:true
});

function onSuccess(imageData) {
var image = document.getElementById('pic1');
image.src = "data:image/jpeg;base64," + imageData;
p1 = image.src;
}

function onFail(message) {
alert('Failed because: ' + message);
}
return false;
}
Photo of Don Kerr, doubletaketech.com

Don Kerr, doubletaketech.com

  • 45 Posts
  • 1 Reply Like

Posted 7 years ago

  • 1
Photo of Abe

Abe

  • 87 Posts
  • 3 Reply Likes
This works for me. Maybe at least try setting the width/height so your image is smaller.

navigator.camera.getPicture(

photoCaptureSuccess,
photoCaptureFailure,
{
quality: 50,
targetWidth: 200,
targetHeight: 200,
correctOrientation: true,
allowEdit: true,
destinationType:Camera.DestinationType.FILE_URI
}
);
Photo of Zahir

Zahir

  • 3500 Posts
  • 40 Reply Likes
Hi Don Kerr,

Do you still need assistance on this matter, or we would close the topic?
Let us know.
Thanks.