TMS WX barcode/QRCode decoder not working via live camera - Android Device

We tried to use the wx barcode/qrCode decoder components with the fncwxcamera component to scan bar- qrcode.

The camera works fine, but the decoder components don't fire an ondecoded event.
We checked the QR/Barodes with other Scanners.. they looks fine.
The link beween the components was set.. but nothing happens when we scan any of the codes.

We use the original demo project and own testprojects. All tests with no result.

Does anyone have any advice on what else we can try?

It should actually be quite simple

  • WXCamera on form
  • WXDecoder (QR or Barcode) on form
  • set link from decoder to camera
  • start camera
  • scan a code

Nothing happens.

Hi,

It's weird none of the decoders work in the demo while the camera still works, it cannot be a browser issue then.
The OnDecoded should fire continuously as it decodes snapshots from the camera (but be aware this doesn't mean each decoding will be successful, that's why the event has an AFound parameter).

Did you test the demo as-is? Are you sure the OnDecoded never fires?
What's your Android version? Which IDE are you using?

we only changed the jar libs to default and added the chorme and helper libs.
No other changes were made.

We use android 11 devices and delphi 11.3 (testet also on 11.2)

Hi,

We retested the demo here but found no issues. The barcode decoding library can be picky on Android but the QR decoder should not have issues so we can use that to narrow this down. What happens if you drop a TTMSFNCWXCamera + TTMSFNCWXQRDecoder on the form, assign the camera to the decoder and implement the OnDecoded event the following way?

procedure TForm1.TMSFNCWXQRDecoder1Decoded(Sender: TObject; AFound: Boolean;
  AResult: string);
begin
  if not AFound then
    Memo1.Lines.Add('Not found')
  else
    Memo1.Lines.Add('Found: ' + AResult);
end;

After starting the camera normally you should see the string 'Not found' continuously added to a TMemo as long as you don't point to a QR code. Then once you move the camera to a QR code, it should then add 'Found: ' + the result from the QR code to the TMemo. Is this not what happens? At which step does it fail?

Hi,

that’s how we tried it in our first tests.
New Test.

  • Componts, Cam, Decoder, memo, button
  • Camera in Decoder -> Set to Cam
  • In Button -> Start cam
  • In OnDecode, the Memo Inserts.

Complete Code below…

On Android 11.. no OnDecoded is fired.
We tested it today with another Android 9 device.. not OnDecoded is fired
No Error, no Warning.. but also no OnDecoded

Delphi target system: Android 32 Bit, SDK 25.2.5

We'll install and Test it again, on Delphi 10 tomorrow

unit Unit1;

interface

uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.TMSFNCTypes, FMX.TMSFNCUtils, FMX.TMSFNCGraphics, FMX.TMSFNCGraphicsTypes,
FMX.Memo.Types, FMX.Controls.Presentation, FMX.ScrollBox, FMX.Memo, FMX.TMSFNCCustomWEBComponent, FMX.TMSFNCWXBarcodeDecoder,
FMX.TMSFNCCustomControl, FMX.TMSFNCWebBrowser, FMX.TMSFNCCustomWEBControl, FMX.TMSFNCWXCamera, FMX.StdCtrls;

type
TForm1 = class(TForm)
TMSFNCWXCamera1: TTMSFNCWXCamera;
TMSFNCWXBarcodeDecoder1: TTMSFNCWXBarcodeDecoder;
Memo1: TMemo;
Button1: TButton;
procedure TMSFNCWXBarcodeDecoder1Decoded(Sender: TObject; AFound: Boolean; AResult: string);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;

var
Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.Button1Click(Sender: TObject);
begin
TMSFNCWXCamera1.Start;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin

end;

procedure TForm1.TMSFNCWXBarcodeDecoder1Decoded(Sender: TObject; AFound: Boolean; AResult: string);
begin
if not AFound then
Memo1.Lines.Add('Not found')
else
Memo1.Lines.Add('Found: ' + AResult);

end;

end.

Can you please try this with TTMSFNCWXQRDecoder instead? It's different from TTMSFNCWXBarcodeDecoder.

Barcode can be tricky to read due to the camera the device picks by default if it has multiple cameras.

  • If it's a wide lens camera, it won't be able to read it properly due to distortion. In that case you'll need to loop through the camera devices and pick one yourself.
  • If the resolution is too low (default is 480x640), it also has a hard time reading and decoding barcodes. You can adjust this via the Resolution property.

But please start with the QR decoding component first so we can narrow the issue down.

We tried a lot of new tests.
On all test devices, we have the permission for camera, data-storage etc..

On Android 11, we now get the onDecoded event.
On Android 10. on one device, it works, on another android 10 device, the cam component doesn't show anything.
On Android 9 Devices.. the cam shows up, but no Event is fired. (neither with AFound = true or false)

All devices in debug Mode.. no error or exception was raised.
All Tests with full permissions on device and the same Testapp.

is there a min adnroid version or other dependence that not shows any error?

if it works, at least the QRDecoder works fine. Barcodes are a bit more susceptible to incorrect decoding. In our case, the biggest problem is getting the component to work on the different andorid versions or devices.

Do you have the same WebView version on both Android 10 devices? You can check this via the Settings menu on your device, the name will be "Android System WebView" or something similar. If the non-working device is using an older version that might be the reason.

Is this also applicable to the QR decoder?

We are not aware of such limitations. As long as your device is running a recent version of Android WebView, it should be fine.

Is your test project similar to the code your posted earlier or did you modify it?

we updated the webview Version.. now it run on both android 10 devices.

Android 9.. does anyway not work.. we get in a few days another android 9 device for tests. We assume, the webview component on the devices should be reason for our problems.

hard to debug because of no errors.

but current, it seems we solved the problem with the manually check of the webview component. we'll add a check-function in our apps an try to check the webview version.
so we can block running the scanner functions without having a correct webview version.

thanks for your advice

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.