2

PhoneGap BarcodeScanner plugin doesn't work in a PhoneJS based app...

Plugin id: com.phonegap.plugins.barcodescanner

Creating a Cordova project from scratch the plugin works fine, But in PhoneJS based template it doesn't!

This is my code:

MyApp.home = function (params) {
    var viewModel = {
        viewShown: function() {
            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);
              }
           );
        }
    };
    return viewModel;
};

I'm using latest version of the plugin 1.1.0, Adobe PhoneGap Build to create project and Galaxy Nexus to test app.

no one solved???

Thnks...

  • The plugin requires Cordova version at least 3.0, but standard PhoneJS app templates (at this point) are based on Cordova 2.9. – amartynov Jan 28 '14 at 07:59

1 Answers1

0

You need to be using Cordova 3+ for this, but the exact project for this can be found here

https://github.com/wildabeast/BarcodeDemo

If you download that zip, upload it to phonegap and run it, it should work fine.

Liam
  • 19
  • 1