ZXing barcode scanner results

0pX00pX0 USMember
edited October 2018 in General

Hi, I'm a noob.
I'm trying get to work zxing barcode scanner.
I'm on Xamarin Forms and fire scanner via image tap gesture.
How can I be notified about scanned barcode in continuous mode?
I've got code like:
`public void ScanBarcode()
{

        var scanner = new MobileBarcodeScanner();
        scanner.UseCustomOverlay = false;


        scanner.TopText = "Saome text";
        scanner.BottomText = "Some text";
        scanner.CancelButtonText = "Cancel";
        var opt = new MobileBarcodeScanningOptions();
        opt.DelayBetweenContinuousScans = 3000;


        scanner.ScanContinuously(opt, HandleScanResult);
        //scanner.Scan();
    }


    void HandleScanResult(ZXing.Result result)
    {
        string msg = "";

        if (result != null && !string.IsNullOrEmpty(result.Text))
        {

            msg = "Scanned: " + result.Text;

            DisplayAlert("Hi", msg, "OK");
        }
        else
        {
            msg = "Cancelled!";
            DisplayAlert("Cancelled", msg, "OK");
        }

    }`

Doesn't get any notifications at all.

Answers

Sign In or Register to comment.