delvedor
delvedor

Reputation: 52

Cordova BarcodeScanner continuous reading

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.

Upvotes: 0

Views: 2295

Answers (2)

Niranjan
Niranjan

Reputation: 21

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

Upvotes: 0

kaoskeya
kaoskeya

Reputation: 1091

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();

Upvotes: 3

Related Questions