Cordova BarcodeScanner continuous reading

2.2k views Asked by At

I'm using MeteorJs and Cordova with the Barcodescanner plugin.
I need to do multiple reads of different qrcodes, and send every read to a remote server.

With this code I can make one read and then Cordova closes the camera (for make a new one I need to recall the code).

cordova.plugins.barcodeScanner.scan(
    function(result) {
        Meteor.call('newQR', result.text);
    },
    function(error) {
        alert("Scanning failed: " + error);
    }
);

How can I make mutiple and continuous readings (without exiting from the camera reader)?

Thanks.

2

There are 2 answers

1
kaoskeya On BEST ANSWER

You could try something like:

function scanBarcode() {
    cordova.plugins.barcodeScanner.scan(
        function(result) {
            Meteor.call('newQR', result.text);
            if( !result.cancelled ) {
                scanBarcode();
            }
        },
        function(error) {
            alert("Scanning failed: " + error);
        }
    );
}
scanBarcode();
0
Niranjan On

In my meteor project ,I have been struggling with a problem of putting cordova barcode scanner inside a fixed div inside a template. Since , you also using same cordova barcode scanner plugin for meteor , i wanted to check whether yo could help any bit regarding this . Problem details is available at following link

MeteorJs putting Cordova barcode scanner inside a fixed div