Open rocifier opened 8 years ago
I saw this in another issue, and tried it:
document.addEventListener("deviceready", function () { if (window.cordova) { alert('window.cordova is available'); } else { alert('window.cordova NOT available'); } }, false); document.addEventListener("deviceready", function () { if (window.cordova && window.cordova.plugins) { alert('window.cordova.plugins is available'); } else { alert('window.cordova.plugins NOT available'); } }, false);
On run as described above, I get: window.cordova is available window.cordova.plugins NOT available
I have the same issue, nothing happens when I click the button. I did check, and window.cordova.plugins is available.
cordova.plugins.barcodeScanner.scan is also available and is a function, so all is correct. I'm using the default example from this github project:
cordova.plugins.barcodeScanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
}
);
But it simply does nothing (apart from my own added alerts before / after )
Could this be some kind of permission error? Any ideas?...
Hi, I tried installing BarcodeScanner into a blank template phongap 5.3.9 project using the following command line while in my project directory:
This created various directories within the project and changed config.xml in the android folder. I then added this code to my index.js under the definition of app:
and this code in html:
but when I host the app using PhoneGap Desktop and access it on my android device using the Phonegap Development App, nothing happens when I tap the button on my app. What am I doing wrong?