Reputation: 1693
I have tried to integrate the BarcodeScanner plugin to one of my Phonegap project of Android. I have even done all the thing step by step as the tutorial provided by github.
The library has been imported,BarcodeScanner.java file has been imported,
barcode.js has been imported,
activity has been added to AndroidManifest.xml
the config.xml in res path has been also modified.
When I test my app with eclipse, I have gotten the error below.
By the way, I have used phonegap 2.9 and my code for using the plugin is as below.
document.addEventListener("deviceready", deviceReady, true);
function deviceReady() {
var scanner = window.plugins.barcodeScanner;//note that cordova.plugins.barcodeScanner has also been tried. Same error.
scanner.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);
});
}
Really do not know what to do. Could you please give me any suggestion?
Thanks in advance.
Upvotes: 0
Views: 521
Reputation: 1693
Finally, I work out it. It is because of Phonegap's version. The version should be above 3.0.
Upvotes: 1