0
votes

I'm trying to implement the barcode scanner plugin on windows phone 7. I carried out the following steps according to the plugin's readme :
1. Added both the dll's to my project.
2. Added barcodescanner.js to the 'www' folder and included the js file in my 'index.html'.
3. Added BarcodeScanner.cs to my project.

I didn't find any guide to implement this on the windows phone platform, so i tried using this guide which was for Android to write the html/js for using the plugin. I have inlcuded a button whose onclick calls the 'Scan()' function :

function Scan() {
window.plugins.barcodeScanner.scan(
    function(result) {
    alert("Scanned Code: " + result.text 
            + ". Format: " + result.format
            + ". Cancelled: " + result.cancelled);
}, function(error) {
    alert("Scan failed: " + error);
});
}

On running the app and clicking the button, I'm getting the following error in the console window :

Error:"Unable to get value of the property 'barcodeScanner': object is null or undefined file:x-wmapp1:/app/www/index.html Line:45"

How do i get this to work?

2

2 Answers

0
votes

This was an issue related to Phonegap 2.7. It worked, somehow, when i tried it on 2.9.0.

0
votes

Did you add the <plugin name="org.apache.cordova.barcodeScanner"> in config.xml