Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use oj-file-picker with camera and gallery with Android device?

3780786Oct 11 2018 — edited Oct 16 2018

HI,

I have being using oj-file-picker  to upload multiple files. If it web application am able to upload multiple files.

If i use android device to upload files,am looking for camera option and gallery option to upload files.

How to do camera capture with oj-file-picker ?

Note : If i use oj-file-picker with camera option ,since i use oj-file-picker it always direct to open gallery

HTML FILE

  <oj-file-picker class='oj-filepicker-custom'

              capture="environment"

                              selectOn='click' id='btnGo'

                              on-oj-select='[[selectListener]]'>

                              <oj-button slot='trigger'>

                                <span slot='startIcon' class='oj-fwk-icon oj-fwk-icon-arrowbox-n'></span>

                                Upload

                           </oj-button>

JS Code

self.  selectListener = function(event) {

    if (navigator.camera && typeof navigator.camera !== "undefined") {

      alert('inside if')

    //  sample camera options, using defaults here but for illustration....

      //Note that the destinationType can be a DATA_URL but cordova plugin warns of memory usage on that.

      var cameraOptions = {

          quality: 50,

          destinationType: Camera.DestinationType.FILE_URL,

          sourceType: Camera.PictureSourceType.CAMERA,

          allowEdit: false,

          encodingType: Camera.EncodingType.JPEG,

          saveToPhotoAlbum: false,

          correctOrientation: true

      };

   

      //use camera pluging method to take a picture, use callbacks for handling result

                 navigator.camera.getPicture(cameraSuccess, cameraError, cameraOptions);

}

Comments
Post Details
Added on Oct 11 2018
1 comment
439 views