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/12/04 13:55:44 UTC

[GitHub] AutoAlert commented on issue #373: Cannot take pictures on Android 8

AutoAlert commented on issue #373: Cannot take pictures on Android 8
URL: https://github.com/apache/cordova-plugin-camera/issues/373#issuecomment-444107561
 
 
   Hi @jcesarmobile thanks for responding. 
   
   We have found the issue. The issue is with our code rather than your plugin.  We were using the following 
   
       function captureImage() {
           navigator.device.capture.captureImage(captureImageSuccess, captureImageError, {limit: 1});
       }
   
       function captureImageSuccess(mediaFiles) {
           uploadFile(mediaFiles[0]);
       }
   
       function uploadFile(mediaFile,fileType) { //#F333
           var win = function (r) {
       }
   
       var options = new FileUploadOptions();
           ImageURL=mediaFile.fullPath;
           options.fileName = (fileType)? mediaFile.name : mediaFile.file; //#F333
           options.mimeType = "multipart/form-data";
           var params = new Object();
           params.fileName = 'AndroidPhoneUpload';
           params.imageType = (fileType)?fileType:'Picture';   //#F333
           var printName = prompt("Add a title","");  //#F644
           if (printName){
               params.printedName = printName;
           }
           window.resolveLocalFileSystemURL(ImageURL, function(fileEntry) {
               fileEntry.file(function(fileObj) {
                   params.fileSize = ""+fileObj.size;
               });
           });
           options.params = params;
           var ft = new FileTransfer();
           ft.upload(ImageURL, encodeURI("uploadURL"),win,fail,options);
       }
   
   Which we have replaced with
   
       navigator.camera.getPicture(function cameraSuccess(imageUri) {
               var options = new FileUploadOptions();
               options.fileKey="file";
               options.fileName="test";
               options.mimeType="multipart/form-data";
               var params = new Object();
               params.fileName = 'AndroidPhoneUpload';           
               options.params = params;
               var ft = new FileTransfer();
               ft.upload(imageUri, encodeURI("https://upload.okappy.com/UploadToS3"), win, fail, options);
           }, function captureImageError(error) {
               console.debug("Unable to obtain picture: " + error, "app");
           }, options);

----------------------------------------------------------------
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