Get Started
In this guide you will learn step-by-step how to add MatrixScan Check to your application. Implementing MatrixScan Check involves two primary elements:
- Barcode Check: The data capture mode that is used for scan and check functionality.
- A Barcode Check View: The pre-built UI elements used to highlight items to be checked.
The general steps are:
- Creating a new Data Capture Context instance
- Configuring the Barcode Check Mode
- Setup the Barcode Check View
- Registering the Listener to notify about found items
Prerequisites
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 Dashboard.
External Dependencies
The Scandit Data Capture SDK modules depend on a few standard libraries that you can find listed below. If you are including the Scandit Data Capture SDK through Gradle or Maven, all of these dependencies are automatically pulled in and there is no need for you to do anything further.
If you directly add the AAR files to the project, you need to add these dependencies yourself.
org.jetbrains.kotlin:kotlin-stdlib:[version]
androidx.annotation:annotation:[version]
Internal Dependencies
Some of the Scandit Data Capture SDK modules depend on others to work:
Module | Dependencies | Optional Dependencies |
---|---|---|
ScanditCaptureCore | None | None |
ScanditBarcodeCapture | ScanditCaptureCore | None |
ScanditParser | None | None |
ScanditLabelCapture | ScanditCaptureCore ScanditBarcodeCapture | ScanditLabelCaptureText ScanditPriceLabel |
ScanditIdCapture | ScanditCaptureCore | ScanditIdCaptureBackend ScanditIdEuropeDrivingLicense ScanditIdAamvaBarcodeVerification ScanditIdVoidedDetection |
When using ID Capture or Label Capture, consult the respective module's getting started guides to identify the optional dependencies required for your use case. The modules you need to include will vary based on the features you intend to use.
Please be aware that your license may only cover a subset of Barcode and/or ID Capture features. If you require additional features, contact us.
Create a Data Capture Context
The first step to add 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.
DataCaptureContext dataCaptureContext = DataCaptureContext.forLicenseKey("-- ENTER YOUR SCANDIT LICENSE KEY HERE --");
Configure the Barcode Check Mode
The main entry point for the Barcode Check Mode is the BarcodeCheck
object. You can configure the supported Symbologies through its BarcodeCheckSettings
, and set up the list of items that you want MatrixScan Check to highlight.
Here we configure it for tracking EAN13 codes, but you should change this to the correct symbologies for your use case.
BarcodeCheckSettings settings = new BarcodeCheckSettings();
settings.enableSymbology(Symbology.EAN13_UPCA, true);
The create the mode with the previously created settings:
BarcodeCheck mode = new BarcodeCheck(dataCaptureContext, settings);
Setup the BarcodeCheckView
MatrixScan Check’s built-in AR user interface includes buttons and overlays that guide the user through the scan and check process. By adding a BarcodeCheckView
, the scanning interface is added automatically to your application.
The BarcodeCheckView
is where you provide the highlightProvider
and/or annotationProvider
to supply the highlight and annotation information for the barcodes to be checked. If null, a default highlight is used and no annotations are provided.
The BarcodeCheckView
appearance can be customized through BarcodeCheckViewSettings
, and the corresponding settings for your desired highlights and/or annotations, to match your application’s look and feel. The following settings can be customized:
- Audio and haptic feedback
- Torch button visibility and its position
- Switch camera button visibility and its position
- Zoom control visibility and its position
- The size, colors, and styles of the highlight and annotation overlays
BarcodeCheckViewSettings viewSettings = new BarcodeCheckViewSettings();
// ...
Next, create a BarcodeCheckView
instance with the Data Capture Context and the settings initialized in the previous step. The BarcodeCheckView
is automatically added to the provided parent view.
BarcodeCheckView barcodeCheckView = BarcodeCheckView.newInstance(parentView, dataCaptureContext, mode, viewSettings);
Connect the BarcodeCheckView
to the Android lifecycle. The view is dependent on calling BarcodeCheckView.onPause()
, BarcodeCheckView.onResume()
, and BarcodeCheckView.onDestroy()
to set up the camera and its overlays properly.
@Override
public void onResume() {
super.onResume();
barcodeCheckView.onResume();
}
@Override
public void onPause() {
super.onPause();
barcodeCheckView.onPause();
}
@Override
public void onDestroyView() {
super.onDestroyView();
barcodeCheckView.onDestroy();
}
Register the Listener
The BarcodeCheckView
displays a Finish button next to its shutter button.
Register a BarcodeCheckViewUiListener to be notified what items have been found once the finish button is pressed.
In this tutorial, we will then navigate back to the previous screen to finish the session.
barcodeCheckView.setUiListener(new BarcodeCheckViewUiListener() {
@Override
public void onFinishButtonTapped(@NonNull BarcodeCheckView view) {
requireActivity().onBackPressed();
}
});
Start Searching
With everything configured, you can now start searching for items. This is done by calling barcodeCheckView.start()
.
barcodeCheckView.start();