Get Started With MatrixScan#

With MatrixScan, you can highlight and interact multiple barcodes within the same frame and build AR experiences. MatrixScan use cases are implemented through functionality provided by BarcodeTracking.

In this guide you will learn step by step how to add BarcodeTracking to your application. Roughly, the steps are:


Before starting with adding a capture mode, make sure that you have a valid Scandit Data Capture SDK license key and that you added the necessary dependencies. If you have not done that yet, check out this guide.


You can retrieve your Scandit Data Capture SDK license key, by signing in to your account at

Internal dependencies#

Some of the Scandit Data Capture SDK modules depend on others to work:




No dependencies


  • ScanditCaptureCore

Create the Data Capture Context#

The first step to add barcode capture capabilities to your application is to create a new data capture context. The context expects a valid Scandit Data Capture SDK license key during construction.

var context = DataCaptureContext.forLicenseKey("-- ENTER YOUR SCANDIT LICENSE KEY HERE --");

Configure the Barcode Tracking Mode#

The main entry point for the Barcode Tracking Mode is the BarcodeTracking object. It is configured through BarcodeTrackingSettings and allows to register one or more listeners that will get informed whenever a new frame has been processed.

Most of the times, you will not need to implement a BarcodeTrackingListener, instead you will add a BarcodeTrackingBasicOverlay and implement a BarcodeTrackingBasicOverlayListener.

For this tutorial, we will setup Barcode Tracking for tracking QR codes.

var settings = BarcodeTrackingSettings()
  ..enableSymbology(Symbology.qr, true);


If your scenario is similar to one described in Barcode Tracking Scenarios, then you should consider using BarcodeTrackingSettings.forScenario() for better results.

Next, create a BarcodeTracking instance with the data capture context and the settings initialized in the previous steps:

var barcodeTracking = BarcodeTracking.forContext(dataCaptureContext, settings);

Use the Built-in Camera#

The data capture context supports using different frame sources to perform recognition on. Most applications will use the built-in camera of the device, e.g. the world-facing camera of a device. The remainder of this tutorial will assume that you use the built-in camera.

When using the built-in camera there are recommended settings for each capture mode. These should be used to achieve the best performance and user experience for the respective mode. The following couple of lines show how to get the recommended settings and create the camera from it:

var cameraSettings = BarcodeTracking.recommendedCameraSettings;

// Depending on the use case further camera settings adjustments can be made here.

var camera = Camera.defaultCamera..applySettings(cameraSettings);

Because the frame source is configurable, the data capture context must be told which frame source to use. This is done with a call to DataCaptureContext.setFrameSource():


The camera is off by default and must be turned on. This is done by calling FrameSource.switchToDesiredState() with a value of FrameSourceState.on:


There is a separate guide for more advanced camera functionality.

Use a Capture View to Visualize the Scan Process#

When using the built-in camera as frame source, you will typically want to display the camera preview on the screen together with UI elements that guide the user through the capturing process. To do that, add a DataCaptureView to your view hierarchy:

var dataCaptureView = DataCaptureView.forContext(dataCaptureContext);
// Add the dataCaptureView to your widget tree

To visualize the results of Barcode Tracking, first you need to add the following overlay:

var overlay = BarcodeTrackingBasicOverlay.withBarcodeTrackingForView(barcodeTracking, dataCaptureView);

Once the overlay has been added, you should implement the BarcodeTrackingBasicOverlayListener interface. The method BarcodeTrackingBasicOverlayListener.brushForTrackedBarcode() is invoked every time a new tracked barcode appears and it can be used to set a brush that will be used to highlight that specific barcode in the overlay.

Brush brushForTrackedBarcode(BarcodeTrackingBasicOverlay overlay, TrackedBarcode trackedBarcode) {// Return a custom Brush based on the tracked barcode.
  // Return a custom Brush based on the tracked barcode.

If you would like to make the highlights tappable, you need to implement the BarcodeTrackingBasicOverlayListener.didTapTrackedBarcode() method.

void didTapTrackedBarcode(BarcodeTrackingBasicOverlay overlay, TrackedBarcode trackedBarcode) {
  // A tracked barcode was tapped.

Get Barcode Tracking Feedback#

Barcode Tracking, unlike Barcode Capture, doesn’t emit feedback (sound or vibration) when a new barcode is recognized. However, you may implement a BarcodeTrackingListener to provide a similar experience. Below, we use the default Feedback, but you may configure it with your own sound or vibration if you want.

Next, use this feedback in a BarcodeTrackingListener:

class FeedbackListener implements BarcodeTrackingListener {
  void didUpdateSession(BarcodeTracking barcodeTracking, BarcodeTrackingSession session) {
    if (session.addedTrackedBarcodes.isNotEmpty) {

BarcodeTrackingListener.didUpdateSession() is invoked for every processed frame. The session parameter contains information about the currently tracked barcodes, in particular, the newly recognized ones. We check if there are any and if so, we emit the feedback.

As the last step, register the listener responsible for emitting the feedback with the BarcodeTracking instance.


Disabling Barcode Tracking#

To disable barcode tracking set BarcodeTracking.isEnabled to false. The effect is immediate: no more frames will be processed after the change. However, if a frame is currently being processed, this frame will be completely processed and deliver any results/callbacks to the registered listeners. Note that disabling the capture mode does not stop the camera, the camera continues to stream frames until it is turned off.


MatrixScan does not support the following symbologies:

  • DotCode

  • MaxiCode

  • All postal codes (KIX, RM4SCC)

What’s next?

To dive further into the Scandit Data Capture SDK we recommend the following articles: