Motivation
The default scan mode provided by the Scandit Barcode Scanner searches barcodes/2d codes in the whole image. This works well when scanning individual codes. However, when scanning codes from sheets with a large number of densely packed barcodes, the full screen scan mode is not optimal as there is little control for the user to decide which code is going to get scanned. With very little code it is possible to implement mechanisms that help selecting the code to be scanned.
Two such "barcode selection modes" have been implemented in the BatchScanSample which is included in the Android SDK.
Aim and Scan
In the first of the two modes, the camera is started with the barcode scanner in paused state. After positioning the phone such that the barcode is in the center of the image, the user presses the "Scan barcode" button to activate the barcode scanner and scan the code.
Steps
To implement the Aim and Scan mode in your application, you will need to do the following:
- Enable and set the restrict active area. This will make sure that codes are only scanned in a very thin band in the center of the image.
- Modify the GUI style to have a "laser" line instead of a square view finder and the scan button to the view
- Resume scanning in scan button action
- Pause the scanner when a barcode is detected, show the value decoded and set the user interface to “stop mode”
Scan and Confirm
In this selection mode, the camera is started and the scanner activated to scan codes. When a code is scanned a confirm dialog is shown where the user can tap confirm when the correct code has been scanned.
Steps
To implement the Scan and Confirm mode in your application, you will need to do the following:
- Enable and set the restrict active area
- Modify the GUI style to have a "laser" line instead of a square view finder
- Start the scanning
- Show the last barcode scanned on the screen