cordova - phonegap camera and android below 4.4 -


my phonegap app (with plugin camera) works fine on recent android os when tried use on android kitkat or older os can select image gallery script wont grab it...any clues ? im guessing there wrong getphoto() function....

my xml :

  <plugin name="cordova-plugin-camera" source="npm" spec="~2.1.1"/> 

my script:

<script type="text/javascript" charset="utf-8"> var picturesource;   // picture source var destinationtype; // sets format of returned value  // wait phonegap connect device // document.addeventlistener("deviceready",ondeviceready,false); // phonegap ready used! // function ondeviceready() {     picturesource=navigator.camera.picturesourcetype;     destinationtype=navigator.camera.destinationtype; } // called when photo retrieved // function onphotodatasuccess(imagedata) {   // image handle   //   var smallimage = document.getelementbyid('smallimage');   // unhide image elements   //   smallimage.style.display = 'block';   // show captured photo   // inline css rules used resize image   //   smallimage.src = "data:image/jpeg;base64," + imagedata; }     // called when photo retrieved // function onphotofilesuccess(imagedata) {   // image handle   console.log(json.stringify(imagedata));    // image handle   //   var smallimage = document.getelementbyid('smallimage');   // unhide image elements   //   smallimage.style.display = 'block';   // show captured photo   // inline css rules used resize image   //   smallimage.src = imagedata;  settimeout(color, 1000); } // called when photo retrieved // function onphotourisuccess(imageuri) {   // uncomment view image file uri    // console.log(imageuri);   // image handle   //   var largeimage = document.getelementbyid('largeimage');   // unhide image elements   //   largeimage.style.display = 'block';   // show captured photo   // inline css rules used resize image   //   largeimage.src = imageuri;    }  // button call function // function capturephotowithdata() {   // take picture using device camera , retrieve image base64-encoded string   navigator.camera.getpicture(onphotodatasuccess, onfail, { quality: 50 }); } function capturephotowithfile() {     navigator.camera.getpicture(onphotofilesuccess, onfail, { quality: 50, destinationtype: camera.destinationtype.file_uri });   }  // button call function // function getphoto() {   // retrieve image file location specified source    navigator.camera.getpicture(onsuccess, onfail,        { quality: 50,destinationtype: camera.destinationtype.file_uri,       sourcetype: navigator.camera.picturesourcetype.savedphotoalbum });  } // called if bad happens. //  function onfail(message) {   alert('failed because: ' + message); }     function onsuccess (imageuri) {     var largeimage = document.getelementbyid ('smallimage');     largeimage.style.display = 'block';      largeimage.src = imageuri;   </script> 

i building on phonegap build , tried on intel xdk ...same result..not working on 4.4.2 , other 4.x os


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -