Friday, 15 March 2013

javascript - cordova 2.9 camera plugin: callbacks not working in android -



javascript - cordova 2.9 camera plugin: callbacks not working in android -

i using cordova 2.9 photographic camera pluginwith next code:

function browsefiles() { alert("browsing files... "); var options = { sourcetype: camera.picturesourcetype.photolibrary, quality: 45, // 50. remain below 50 per phonegap doc ios memory issues destinationtype: camera.destinationtype.data_url, //encodingtype: camera.encodingtype.jpeg, //savetophotoalbum: true, correctorientation: true, // outofmemoryerror on samsung galaxy s3 (and other android) if don't specify size. // see thread: https://groups.google.com/forum/?fromgroups=#!topic/phonegap/ywzlnfufrje targetwidth: 400, targetheight: 400 }; nativebridge.captureimage(function (_data) { //alert("data: " + _data); $("#myimage").attr('src', "data:image/jpeg;base64," + _data); $("#myimage").attr('data-base64', _data); }, undefined, options); }; captureimage: function (camerasuccess, cameraerror,customoptions) { if (!cameraerror) { cameraerror = function (message) { nativebridge.alert('failed because: ' + message); } } if (jscontext.getiswebapp() == true) { webapp.captureimage(camerasuccess, cameraerror, customoptions); } else { if (navigator.camera && navigator.camera.getpicture) { seek { var options = {}; if (customoptions) { options = customoptions; } else { options = { sourcetype: camera.picturesourcetype.camera, quality: 45, // 50. remain below 50 per phonegap doc ios memory issues destinationtype: camera.destinationtype.data_url, //encodingtype: camera.encodingtype.jpeg, //savetophotoalbum: true, correctorientation: true, // outofmemoryerror on samsung galaxy s3 (and other android) if don't specify size. // see thread: https://groups.google.com/forum/?fromgroups=#!topic/phonegap/ywzlnfufrje targetwidth: 400, targetheight: 400 }; } // old options {quality: 50,destinationtype: camera.destinationtype.data_url } navigator.camera.getpicture(camerasuccess, cameraerror, options); } grab (err) { cameraerror(err); } } else { nativebridge.alert("camera not supported"); } } } }

but callback never called on android device. on iphone works normally, debugged application , comes in logcat:

06-26 16:34:47.417: w/iinputconnectionwrapper(27159): showstatusicon on inactive inputconnection 1:35 pm 06-26 16:35:07.792: i/info(27159): width : 1280 1:35 pm 06-26 16:35:07.792: i/info(27159): height : 720 1:35 pm 06-26 16:35:07.822: d/webview(27159): loadurlimpl: called 1:35 pm 06-26 16:35:07.822: d/webcore(27159): core loadurl: called 1:36 pm 06-26 16:35:07.872: v/customviewbehind(27159): behind invisible 1:36 pm 06-26 16:35:08.227: i/info(27159): width : 720 1:36 pm 06-26 16:35:08.227: i/info(27159): height : 1280 1:36 pm 06-26 16:35:08.337: i/system.out(27159): not drm file, opening notmally 1:36 pm 06-26 16:35:08.337: i/system.out(27159): buffer returned  1:36 pm 06-26 16:35:08.342: v/customviewbehind(27159): behind invisible 1:36 pm

any help appreciated

javascript android ios cordova camera

No comments:

Post a Comment