Deprecation warning
Please note that this is outdated documentation for an older release of the Scandit Barcode Scanner SDK.
We are deprecating the 5.x API on all platforms (except Linux). Release 5.19 in April 2021 will be our final. Applications running 5.x will continue to work, and we will continue to release critical bug fixes and security patches only, for one year. We encourage you to migrate to 6.x and take advantage of our latest / advanced features and improved performance.
You'll find the updated documentation at: Data Capture SDK Documentation for Android
Inherits RelativeLayout, and BarcodePickerInterface.
Public Member Functions | |
BarcodePicker (Context context, ScanSettings settings) | |
void | applyScanSettings (ScanSettings settings) |
void | applyScanSettings (ScanSettings settings, Runnable completionCallback) |
void | pauseScanning () |
void | pauseScanning (Runnable completionCallback) |
void | resumeScanning () |
void | resumeScanning (Runnable completionCallback) |
void | setOnScanListener (OnScanListener listener) |
void | setPropertyChangeListener (PropertyChangeListener listener) |
void | setTextRecognitionListener (TextRecognitionListener listener) |
void | setAutoFocusOnTapEnabled (boolean enabled) |
void | stopScanning () |
void | stopScanning (Runnable completionCallback) |
void | startScanning () |
void | startScanning (boolean startInPausedState) |
void | startScanning (boolean startInPausedState, Runnable completionCallback) |
void | switchTorchOn (boolean on) |
ScanOverlay | getOverlayView () |
void | setProcessFrameListener (ProcessFrameListener processFrameListener) |
Point | convertPointToPickerCoordinates (Point point) |
void | setPinchToZoomEnabled (boolean enabled) |
Parser | createParserForFormat (int parser_format) |
Static Public Member Functions | |
static boolean | canRunPortraitPicker () |
Detailed Description
The main interface for scanning barcodes with the Scandit BarcodeScanner SDK.
This class sets up the recognition process, the preview view, controls the camera and provides a callback interface when barcodes are recognized.
The picker class is a able to run in full-screen or as a subview in an existing activity.
- Since
- 4.9.0
Constructor & Destructor Documentation
BarcodePicker | ( | Context | context, |
ScanSettings | settings | ||
) |
Construct a new barcode picker with the given scan settings.
- Parameters
-
context the context that the barcode picker belongs to. settings the settings to use.
Member Function Documentation
void applyScanSettings | ( | ScanSettings | settings | ) |
Reconfigure the barcode picker with new settings.
The settings are applied asynchronously. Once they have been applied, all new frames will be processed with the new settings.
- Parameters
-
settings the settings to apply.
void applyScanSettings | ( | ScanSettings | settings, |
Runnable | completionCallback | ||
) |
Reconfigure the barcode picker with new settings.
The settings are applied asynchronously. Once they have been applied, all new frames will be processed with the new settings.
- Parameters
-
settings the settings to apply. completionCallback runnable to be executed when the new settings have been applied.
- Since
- 4.15.0
void pauseScanning | ( | ) |
Asynchronously pause the scanning process while keeping the camera preview running.
Use this method when you plan to briefly pause the scanning process and intend to resume it later. It is not recommended to use this method when you are interrupting the scanning process for longer periods of time as the camera preview will use considerable power. For such scenarios use stopScanning instead.
- Since
- 4.9.0
void pauseScanning | ( | Runnable | completionCallback | ) |
Asynchronously pause the scanning process while keeping the camera preview running.
Use this method when you plan to briefly pause the scanning process and intend to resume it later. It is not recommended to use this method when you are interrupting the scanning process for longer periods of time as the camera preview will use considerable power. For such scenarios use stopScanning instead.
- Parameters
-
completionCallback Runnable to be executed when the scanning has been paused.
- Since
- 4.15.0
void resumeScanning | ( | ) |
Asynchronously resume a previously paused scanning process.
Use this method to resume scanning after ScanSession.pauseScanning or pauseScanning was called. Calling resume on a picker that was not previously started with startScanning() is undefined.
- Since
- 4.9.0
void resumeScanning | ( | Runnable | completionCallback | ) |
Asynchronously resume a previously paused scanning process.
Use this method to resume scanning after ScanSession.pauseScanning or pauseScanning was called. Calling resume on a picker that was not previously started with startScanning() is undefined.
- Parameters
-
completionCallback Runnable to be executed when the scanning has been resumed.
- Since
- 4.15.0
void setOnScanListener | ( | OnScanListener | listener | ) |
Set callback to be invoked whenever a new code is recognized.
- See also
- OnScanListener.didScan
- Parameters
-
listener the listener to register. A strong reference is kept to the listener.
void setPropertyChangeListener | ( | PropertyChangeListener | listener | ) |
Register a listener for scan state change events.
- Parameters
-
listener the listener to register. A strong reference is kept to the listener
void setTextRecognitionListener | ( | TextRecognitionListener | listener | ) |
Register a listener for text recognition events.
- Parameters
-
listener the listener to register. A strong reference is kept to the listener
- Since
- 5.4
void setAutoFocusOnTapEnabled | ( | boolean | enabled | ) |
Enable/disable auto-focus on tap.
By default, a tap on the camera preview causes an auto-focus event. Set this property to false to disable this behavior.
- Parameters
-
enabled Whether to enable/disable auto-focus on tap.
- Since
- 5.1
void stopScanning | ( | ) |
Asynchronously stop the scanning process and camera preview.
void stopScanning | ( | Runnable | completionCallback | ) |
Asynchronously stop the scanning process and camera preview.
- Parameters
-
completionCallback Runnable to be executed when scanning and preview has been stopped.
- Since
- 4.15.0
void startScanning | ( | ) |
Asynchronously start the camera preview and scanning process.
void startScanning | ( | boolean | startInPausedState | ) |
Asynchronously start the camera preview and scanning process.
Allows to start the camera preview without immediately also starting the scanning process.
- Parameters
-
startInPausedState Whether the scanning process should be paused.
void startScanning | ( | boolean | startInPausedState, |
Runnable | completionCallback | ||
) |
Asynchronously start the camera preview and scanning process.
Allows to start the camera preview without immediately also starting the scanning process.
- Parameters
-
startInPausedState Whether the scanning process should be paused. completionCallback Runnable to be executed when the scanning has been started.
- Since
- 4.15.0
void switchTorchOn | ( | boolean | on | ) |
Switches the torch (if available) on or off programmatically.
There is also a method in the ScanditSDKOverlayController to add a torch icon that the user can click to activate the torch.
- Parameters
-
on true when the torch should be switched on, false if the torch should be turned off.
ScanOverlay getOverlayView | ( | ) |
The overlay view that controls the scan user interface.
The Scandit BarcodeScanner contains a default implementation that developers can inherit from to define their own scan UI (enterprise licensees only). The overlay view inherits from RelativeLayout.
- Returns
- the overlay view
void setProcessFrameListener | ( | ProcessFrameListener | processFrameListener | ) |
Set listener to be called whenever a frame has been processed.
- Parameters
-
processFrameListener the listener to register.
|
static |
- Returns
- True if the BarcodePicker can be used in portrait scanning mode. This method only returns false on a few selected Android 2.3+ devices that have incomplete camera drivers.
Point convertPointToPickerCoordinates | ( | Point | point | ) |
Converts a point of an Barcode's location into this picker's coordinate system.
The conversion takes the current resolution of the camera feed into consideration which means that if the resolution should change, converting a previously retrieved point successfully is no longer possible. A change in resolution happens for example if ScanSettings.setHighDensityModeEnabled(boolean) is changed or the camera is switched from back to front or vice versa.
- Parameters
-
point The point to be converted.
- Returns
- The point in this picker's coordinate system. Can be null if an error occurs.
void setPinchToZoomEnabled | ( | boolean | enabled | ) |
Enable/disable pinch to zoom.
By default, the video zoom factor can be controlled with a pinch gesture. Set this property to false to disable this feature.
- Parameters
-
enabled Whether to enable the pinch to zoom functionality
- Since
- 4.15
Parser createParserForFormat | ( | int | parser_format | ) |
Instantiates a parser object.
- Parameters
-
parser_format The format of the input data for the parser.
- Returns
- A parser instance or an exception on error
This method only returns a parser instance if the license used to instantiate the picker includes the usage of the Scandit Parser Library. Otherwise an exception will be thrown.
- Since
- 5.5.0
The documentation for this class was generated from the following file:
- BarcodePicker.java