So the plugin works on most of the devices, it works on IOS perfectly. But on 
android it works on some devices and on some devices once the picture is taken 
the user is send back to app, app crashes. Now the only thing that I am doing 
is storing this image in an array. Now one more thing is that if I take a 
picture and click on retake and then submit the second image the app does not 
crashes but if I submit the first image it crashes.

Here is my function:
uploadImage() {
    this.actionCtrl.create({
      title:  'Upload Image',
      buttons: [
        {
          icon: 'camera',
          text: 'Open Camera',
          handler: () => {
            const options: CameraOptions = {
              quality: 100,
              destinationType: this.camera.DestinationType.DATA_URL,
              encodingType: this.camera.EncodingType.JPEG,
              mediaType: this.camera.MediaType.PICTURE,
              sourceType: 1
            }

            this.camera.getPicture(options).then((imageData) => {
              let base64Image = 'data:image/jpeg;base64,' + imageData;
              this.images.push(base64Image);
              console.log(base64Image);
            }, (err) => {
              console.log('Error Uploading File')
            });
          }
        },
        {
          icon: 'image',
          text:  'Open Gallery',
          handler: () => {
            const options: CameraOptions = {
              quality: 100,
              destinationType: this.camera.DestinationType.DATA_URL,
              encodingType: this.camera.EncodingType.JPEG,
              mediaType: this.camera.MediaType.PICTURE,
              sourceType: 0
            }

            this.camera.getPicture(options).then((imageData) => {
              let base64Image = 'data:image/jpeg;base64,' + imageData;
              this.images.push(base64Image);
            }, (err) => {
              console.log('Error Uploading File')
            });
          }
        }
      ]
    }).present();
  }


[ Full content available at: 
https://github.com/apache/cordova-plugin-camera/issues/345 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to