javascript - navigator.camera is undefined while integrating with visualforce and jquery mobile -



javascript - navigator.camera is undefined while integrating with visualforce and jquery mobile -

i trying access photographic camera using jquery mobile , cordova in app . cordova getting initilized unable navigator.camera properties. navigator.camera undefined . believe imported cordova correctly , gave permissions well.

i gave

<uses-permission android:name="android.permission.camera"/> <uses-permission android:name="android.permission.write_external_storage" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" />

and page is

<!doctype html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0; user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <link rel="stylesheet" href="css/jquery.mobile.min.css" /> <script src="js/jquery.min.js"></script> <script src="js/jquery.mobile.min.js"></script> <script src="cordova.js"></script> <script src="js/forcetk.mobilesdk.js"></script> <style> .logwindow {display:none; width:700px;} .logwindow > p {padding:0px; margin:0px; word-wrap:break-word;} </style> <script> var apiversion = "v31.0"; var forcetkclient; var debugmode = true; var picturesource; // image source var destinationtype; // sets format of returned value jquery(document).ready(function() { document.addeventlistener("deviceready", ondeviceready,false); }); function ondeviceready() { cordova.require("com.salesforce.util.logger").logtoconsole("ondeviceready: cordova ready"); cordova.require("com.salesforce.plugin.oauth").getauthcredentials(salesforcesessionrefreshed, getauthcredentialserror); document.addeventlistener("salesforcesessionrefresh",salesforcesessionrefreshed,false); reglinkclickhandlers(); } function salesforcesessionrefreshed(creds) { cordova.require("com.salesforce.util.logger").logtoconsole("salesforcesessionrefreshed"); var credsdata = creds; if (creds.data) // event sets `data` object auth data. credsdata = creds.data; forcetkclient = new forcetk.client(credsdata.clientid, credsdata.loginurl, null, cordova.require("com.salesforce.plugin.oauth").forcetkrefresh); forcetkclient.setsessiontoken(credsdata.accesstoken, apiversion, credsdata.instanceurl); forcetkclient.setrefreshtoken(credsdata.refreshtoken); forcetkclient.setuseragentstring(credsdata.useragent); } function getauthcredentialserror(error) { cordova.require("com.salesforce.util.logger").logtoconsole("getauthcredentialserror: " + error); } function takepic() { alert(navigator.camera); navigator.camera.getpicture(onpicsuccess, onpicfail, { quality: 50, destinationtype: camera.destinationtype.data_url }); } function onpicsuccess(imagedata) { inspectionscontroller.saveinspectionimage(imagedata, inspectionrec, function(res,event){ }); } function onpicfail(message) { console.log("pic failed: " + json.stringify(message)); } </script> <script src="inline.js"></script> </head> <body> <div data-role="page" data-theme="b" id="jqm-home"> <div data-role="header"> <h1>salesforce , device contacts</h1> </div> <div id="#content" data-role="content"> <a onclick="takepic();" href="#" data-theme="a" data-iconpos="top" id="picbtn" data-role="button">take picture</a> <h3>console:</h3> <p id="console" class="logwindow"> </p> </div> </div> </body>

my project construction is

could 1 help me out of undefined value of navigator.camera

javascript android jquery cordova

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -