Tuesday, September 5, 2017

Scanning barcodes the FDK-way

You like to scan barcodes in your app?


Ok, you probably googled this topic! But you will find solutions only for iOS or solutions only for Android. Perhaps a preinstalled third-party app must be installed.


Of course, there are solutions for both platforms, but for free?


And how long does it take to integrate this into your app?


Perhaps you consider the FDK approach:


Uses
   Delphiprofi.FDK.AnyFactory,

   Delphiprofi.FDK.Barcode;

var
  FScanbarcodes : ICanScanBarcodes;

procedure TFormMain.ScanClick(Sender: TObject);
begin
  FScanbarcodes := TAnyFactory.Factory.CreateObj<ICanScanBarcodes>;
  FScanBarcodes.ScanResult(Procedure (AResult : String)
    begin
      LBLScanResult.Text := AResult;
      FScanbarcodes := NIL;
    end).Scan;
end;



Internal I'm using the ZXING Source for Android. For iOS you can choose between the ZBar or the ZXING version. ZBar ist based on the TMSWrapper for ZBar!


The ZXING Version is inspired by MVP Andrea Magni but without the FrameStand and other overhead.


Threading is done with my TAnyCommandProcessor, which can queue the workflow for the Bitmaps, that are captured with the TCameraComponent!

No comments:

Post a Comment