How To Integrate Barcode Scanner In Phonegap In Android Platform?
I want to integrate a 'barcodescanner'-feature into my PhoneGap Application, but facing problem while running my app 'class not found or applicationcontent is missing in applicatio
Solution 1:
I just tested it and works fine :
<!DOCTYPE html><html><head><metacharset="utf-8" /><metaname="format-detection"content="telephone=no" /><metaname="msapplication-tap-highlight"content="no" /><metaname="viewport"content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /><linkrel="stylesheet"type="text/css"href="css/index.css" /></head><body><buttononclick="scanBarcode()">Scan</button><scripttype="text/javascript"src="cordova.js"></script><scripttype="text/javascript"src="js/index.js"></script><script>functionscanBarcode(){
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);
}
);
}
</script></body></html>
The issue with your code is that you don't have functions scan() and encode() to bind to your buttons thus nothing will happen.
Post a Comment for "How To Integrate Barcode Scanner In Phonegap In Android Platform?"