Skip to content

How to debug from Cordova #2

Description

@padelt

I try to use the rearview camera of an Amazon Fire 7 Tablet to recognize multiple barcodes in a semi-continous way and FastBarcodeScanner seems to be exactly what I want. Being fairly new to Android development, I struggle to understand what is happening.

I try to start a scan using this code:

        document.getElementById("scanbutton").addEventListener("click", function() {
            var fb = cordova.require("cordova-plugin-fast-barcode-scanner.fastbarcodescanner");
            fb.showToast("A toast!");
            fb.startScanning(function(winParam) {
                // success
                console.log("success");
            }, function (error) {
                // fail
                console.log(error);
            });
        });

Via adb logcat | egrep "(Fast|Fast|chromium)" I can see that tapping my button triggers the click callback:

D/Fast Barcode Scanner Plugin( 2368): initialize
D/Fast Barcode Scanner Plugin( 2368): Action: showToast
D/Fast Barcode Scanner Plugin( 2368): Action: startScanning
D/Fast Barcode Scanner Plugin( 2368): Start scanning
D/Fast Barcode Scanner Plugin( 2368): Check camera permission
D/Fast Barcode Scanner Plugin( 2368): ...already have camera permission - life is good
W/PluginManager( 2368): THREAD WARNING: exec() call to FastBarcodeScannerPlugin.startScanning blocked the main thread for 111ms. Plugin should use CordovaInterface.getThreadPool().
D/Fast Barcode Scanner Plugin( 2368): Registering scan Callback
D/Fast Barcode Scanner Plugin( 2368): Pause

The Pause is the moment where I leave the app.

My problem is that I do not seem to be called back no matter which camera I show any QR or Code128 barcode. Since I cannot see the camera image, it is hard to judge what is going on. The other log messages indicate that the image is captured. The "showToast" call does nothing, by the way. I somehow expected to see a splash screen or something like that.

What is the best way to dig deeper from here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions