android - ionic navigator.camera.getPicture won't return image from PHOTOLIBRARY -


i've added cordova-plugin-camera plugin ionic app, in order use both of adnavtages - take picture using camera, , image photo gallery.

taking picture using camera works on android galaxy s3 device, getting image gallery returns null in success result function.

i've tried using both $cordovacamera.getpicture described here , navigator.camera.getpicture this example, both returns null result param in success method, after select image on device.

i've tried playing of params, tried getting of 3 options of destinationtype (data_url, file_url, native_uri), tried saving/unsaving gallery, edit/unedit, encoding type explicity of jpeg, mediatype picture, etc.. none of them worked photolibrary or savedphotoalbum, works fine camera

this code wrote:

ver 1:

    var options = {   destinationtype: camera.destinationtype.file_uri,   sourcetype: camera.picturesourcetype.photolibrary,   correctorientation: true,   allowedit: true };  $cordovacamera.getpicture(options) .then(function (imageuri) {     if (!imageuri) {       console.log('getpicture: no image selected');       return;     }     // upload image server code goes here   }); 

ver 2:

    navigator.camera.getpicture(onsuccess, onfail,    {      destinationtype: camera.destinationtype.file_uri,     sourcetype: camera.picturesourcetype.photolibrary,     correctorientation: true,     allowedit: true });  function onsuccess(imagedata) {   console.log(imagedata);   // upload image server code goes here }  function onfail(message) {     alert('failed because: ' + message); } 

can advice problem? (why imageuri/imagedata null) maybe miss configuration somewhere? i'm out of ideas..

i've asked same question in ionic framework forum , fajohann answered when has installed older version of plugin worked fine. i've tried myself, installing previous versions 1 one until made working. i've found out latest version support android (doesnt return null when picking image) v1.2.0

in order install should run command:

ionic plugin add cordova-plugin-camera@1.2.0


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -