You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/09/18 16:41:25 UTC

[GitHub] hamzatrq opened a new issue #345: Camera plugin crashes app on some android phones when an image is taken

hamzatrq opened a new issue #345: Camera plugin crashes app on some android phones when an image is taken
URL: https://github.com/apache/cordova-plugin-camera/issues/345
 
 
   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();
     }
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org