Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-10246

camera.getPicture fails with “Camera cancelled”

    XMLWordPrintableJSON

Details

    Description

      Hi All,

      I'm developing a cordova app (cli-5.2.0) in which pictures are taken using the cordova camera plugin
      (cordova-plugin-camera, version 1.2.0).

      var camera = navigator.camera; 
      var cameraOptions = {  
        destinationType: Camera.DestinationType.DATA_URL 
      };
      
      camera.getPicture(function(result) {
            alert('success');
          }, function(error) {
             alert('fail ' + error);
          }, cameraOptions);
      
      

      This code works fine.. ..most of the time.
      On a particular slow android 4.4.4 device, this only works fine like 9 out of 10 times.
      In like 1 out of 10, the call fails saying 'Camera cancelled' (although it was not cancelled with the back button or something).

      In that case, the failure callback 'Camera cancelled' is fired, and right after that, the Camera UI is shown nevertheless.
      (if a picture is taken then, the success callback is not called).

      It's hard to tell when this happens, but it looks like it happens more often if the device is app is more busy.
      The log files do not show much more detail, except for things like:

      Attempted to send a second callback for ID: Camera1337050609

      However, these logs are also written if the call succeeds.

      Any hints or help is much appreciated.

      Thanks for your time,
      Koen

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              koenj Koen Jans
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: