title: Taking a picture from the camera fails 20% of the time
body: <pre><code>var camera = {
    settings : {
      quality : 50,
      targetWidth : 1024,
      targetHeight : 1024,
      correctOrientation : true
    }
  };
  var error = function(message) {
    alert("Error happened while trying to get a picture", message);
  };
  document.addEventListener("deviceready", function() {
    camera.toFile = function() {
      this.settings.destinationType = navigator.camera.DestinationType.FILE_URI;
      return this;
    },
    camera.toBase64 = function() {
      this.settings.destinationType = navigator.camera.DestinationType.DATA_URL;
      return this;
    },
    camera.fromCamera = function() {
      this.settings.sourceType = navigator.camera.PictureSourceType.CAMERA;
      return this;
    };
    camera.fromLibrary = function() {
      this.settings.sourceType = navigator.camera.PictureSourceType.PHOTOLIBRARY;
      return this;
    };
    camera.fromPhotoAlbum = function() {
      this.settings.sourceType = navigator.camera.PictureSourceType.SAVEDPHOTOALBUM;
      return this;
    }
    camera.get = function(callback) {
      navigator.camera.getPicture(function(data) {
        alert("taking a picture successful");
        callback(data);
      }, error, camera.settings);
    };
  }, false);
  </code></pre>
  
  <p>This is my small wrapper for the camera. And I call it like this:</p>
  
  <pre><code>camera.fromPhotoAlbum().toBase64().get(function(base64){});
  </code></pre>
  
  <p>About 20% of the time, the "alert("taking a picture successful");" is not called, while no error is shown. If I cancel taking a picture, an alert with the message "Error happened while trying to get a picture" is shown, so the error callback works.</p>
  
  <p>Basically nothing happens. I've tested it on a Samsung Galaxy S2 on CM9 and a brand new HTC One X.</p>