Kotlin
Multiple Barcode Scanning
Multiple Barcode Scanning is a mode in the Vision SDK that allows you to scan and detect multiple barcodes within the camera frame simultaneously. This is useful in scenarios where several barcodes are present in a single image or view, and you want to capture all of them in one go.
Unlike single barcode scanning, this mode does not restrict detection to just one barcode. Instead, it returns an array of all valid barcodes detected within the scanning region, improving efficiency for batch processing or document scanning use cases.
⚙️ Configure the SDK
To enable multiple barcode scanning, you need to configure the Vision SDK using the configure
method:
Select the camera lens you want to use for barcode scanning:
🤖 Auto Mode Barcode Scanning
For automatic barcode capture, set the scanningMode
to ScanningMode.Auto
:
Configuration example:
✋ Manual Mode Barcode Scanning
For manual barcode capture, set the scanningMode
to ScanningMode.Manual
:
Configuration example:
Afterwards, when you want to capture, call the following method:
📦 Callback Method for Barcode Values
When a barcode is successfully scanned, the following callback method is called:
Note that, once onScanResult
or onImageCaptured
callbacks are called, VisionSDK will stop analyzing camera feed for text or barcodes/QR codes.
This is to prevent extra processing and battery consumption. When client wants to start analyzing camera feed again, after consuming the results of previous scan, client needs to call the following function:
❗️Error Handling Callback
If an error occurs during the barcode scanning process, the following callback method will be triggered. You can implement this to handle any failures during scanning, gracefully.
Use this method to log errors, display messages to the user, or perform recovery actions when scanning fails.
🧾 Barcode Object Structure
The ScannedCodeResult
object returned in the callback contains the following properties:
🧭 Detection Indicators
To receive detection indicators (without actual values), implement the following callback method:
textDetected
: Indicates presence of textbarcodeDetected
: Indicates presence of a barcodeqrCodeDetected
: Indicates presence of a QR codedocumentDetected
: Indicates presence of a document
🔘 Enable Detection Indicators
You can toggle detection indicators as follows:
🧪 Sample Code
To start scanning for barcodes, QR codes, text or documents, use the startCamera method. See the code below for example: