How to use: cordova / phonegap-plugin-barcodescanner


#1

Hey guys,

Has anyone ever used this plugin and knows how to configure it?
I read the documentation many times, but haven’t understood how to do it: https://github.com/phonegap/phonegap-plugin-barcodescanner

I would like to know where to put the configuration, where to call the scan method and how to redirect the user to the QR Code’s URL.

Thanks!


#2

I am running meteor on my iOS device through XCode.
This is my code, which unfortunately is not working. When I click on the #scan button, nothing happens.

qr-scan.js

if(Meteor.isClient){

    Template.QRScan.helpers({

        'click #scan'(){
            cordova.plugins.barcodeScanner.scan(
                function( result ) {
                    if ( !result.cancelled ) {
                        window.open( result.text, "_blank" )
                    }
                },
                function( error ) {
                    navigator.notification.alert( "Unfortunately there was a problem reading the barcode." );
                }
            );
        }

    });

}