Forum Xamarin Xamarin.Forms

Scanbot Barcode Reader issue

AMNKumariAMNKumari USMember ✭✭✭
edited October 16 in Xamarin.Forms

I have added Scanbot SDK for Xamarin project. my barcode reader working sometimes. Not working continuously. Cam is opening and closing again without reading the barcode.

 var configuration = new BarcodeScannerConfiguration
                        {
                            AcceptedFormats = new List<BarcodeFormat>() { BarcodeFormat.Code128,
                            BarcodeFormat.QrCode,
                            BarcodeFormat.Code39,
                            BarcodeFormat.Code93,
                            BarcodeFormat.DataMatrix,
                            BarcodeFormat.Codabar,
                            BarcodeFormat.Aztec,
                            BarcodeFormat.Ean8,
                            BarcodeFormat.Ean13 },
                            SuccessBeepEnabled = true,
                            CancelButtonTitle = Resources.Cancel,
                            FinderLineColor = Color.Red,
                            FlashEnabled = true,
                            FlashButtonTitle = "Flash",
                            TopBarButtonsColor = Color.Red,
                            OrientationLockMode = CameraOrientationMode.Portrait
                        };
Device.BeginInvokeOnMainThread(async () =>
                    {                            
                        SBSDK.Operations.ClearStorageDirectory();
                        BarcodeResultBundle result = await SBSDK.Scanner.Open(configuration);

                        if (result?.Barcodes?.Count >= 1)
                            foreach (var barcode in result.Barcodes)
                                tool.ToolValue = barcode?.Text;

                        if (executeAction)
                            await ButtonCommand(tool?.ToolId, null);
                    });

I have use this settings and codes for do this.
https://scanbotsdk.github.io/documentation/barcode-scanner-sdk/xamarin/

Tagged:

Answers

  • JarvanJarvan Member, Xamarin Team Xamurai

    Not working continuously. Cam is opening and closing again without reading the barcode.

    I checked the tutorial about the function method from the posted link, but did not get the 'SBSDK.Scanner.Open' method. For the scanner functin, try the following code:

    var config = new DocumentScannerConfiguration();
    var result = await SBSDK.UI.LaunchDocumentScannerAsync(config);
    if (result.Status == OperationResult.Ok)
    {
        // result.Pages contains the scanned pages
    }
    
  • AMNKumariAMNKumari USMember ✭✭✭

    @Jarvan said:

    Not working continuously. Cam is opening and closing again without reading the barcode.

    I checked the tutorial about the function method from the posted link, but did not get the 'SBSDK.Scanner.Open' method. For the scanner functin, try the following code:

    var config = new DocumentScannerConfiguration();
    var result = await SBSDK.UI.LaunchDocumentScannerAsync(config);
    if (result.Status == OperationResult.Ok)
    {
        // result.Pages contains the scanned pages
    }
    

    I have already added Open part. Scanner is openning. But its closing too fast without read it

Sign In or Register to comment.