Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Error capturing image' with Phonegap on Android

I need to capture an image with my Phonegap app. On iOS everything works fine but on Android (via Phonegap Build) it throws an error with "Error capturing image".

I added the following lines to my config.xml but that doesn't change anything:

<feature name="Camera">
    <param name="android-package" value="org.apache.cordova.camera.CameraLauncher" />
</feature>
<feature name="http://api.phonegap.com/1.0/device" />
<feature name="http://api.phonegap.com/1.0/camera" />
<feature name="http://api.phonegap.com/1.0/file" />
<feature name="http://api.phonegap.com/1.0/media" />
<feature name="http://api.phonegap.com/1.0/network" />

My API call looks like that:

    $(document).on('click', '#cameraPreview', function() {
        pictureSource = navigator.camera.PictureSourceType;
        destinationType = navigator.camera.DestinationType;

        navigator.camera.getPicture(onGetPictureSuccess, onGetPictureFail, {
          quality: 40,
          sourceType: Camera.PictureSourceType.CAMERA,
          destinationType: Camera.DestinationType.FILE_URI,
          allowEdit: true,
            encodingType: Camera.EncodingType.JPG,
          targetWidth: 1000,
          targetHeight: 1000,
          saveToPhotoAlbum: true,
          correctOrientation: 1
        });
    });

I use Phonegap 3.7 with Phonegap Build.

like image 528
John Brunner Avatar asked Apr 01 '15 13:04

John Brunner


1 Answers

Ok, now I know the answer. The problem is the saveToPhotoAlbum: true option. Android doesn't recognize this. When I delete this option everything works fine.

like image 144
John Brunner Avatar answered Nov 03 '22 01:11

John Brunner