Inherits RelativeLayout, and BarcodePickerInterface.
Static Public Member Functions | |
static boolean | canRunPortraitPicker () |
Static Public Attributes | |
static final String | VERSION |
Recognition Warnings | |
static final int | TOO_MUCH_GLARE_WARNING |
static final int | NOT_ENOUGH_CONTRAST_WARNING |
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 | ( | ) |
Synchronously stop the scanning process and camera preview.
void stopScanning | ( | Runnable | completionCallback | ) |
Synchronously 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.
This method should only be called after scanning has been started. Otherwise, it will have no effect.
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 | parserFormat | ) |
Instantiates a parser object.
- Parameters
-
parserFormat 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
BarcodeGenerator createBarcodeGeneratorForSymbology | ( | int | symbology | ) |
Instantiates a barcode generator object.
- Parameters
-
symbology The symbology of the barcode generator. Has to be one of: SYMBOLOGY_EAN13, SYMBOLOGY_UPCA, SYMBOLOGY_CODE128, SYMBOLOGY_QR, SYMBOLOGY_DATA_MATRIX.
- Returns
- A barcode generator instance or an exception on error.
This method only returns a barcode generator instance if the license used to instantiate the picker includes the usage of the Scandit barcode generator. Otherwise an exception will be thrown. The supported symbologies for the barcode generator are as follows: SYMBOLOGY_EAN13, SYMBOLOGY_UPCA, SYMBOLOGY_CODE128, SYMBOLOGY_QR, SYMBOLOGY_DATA_MATRIX.
- Since
- 5.8.0
void setLicenseValidationListener | ( | LicenseValidationListener | listener | ) |
Register a license validation listener for this barcode picker.
LicenseValidationListener.failedToValidateLicense(String) is invoked on the registered listener whenever license validation fails. The possible reasons for the method to be called can be e.g. license expiration or missing API key.
- Parameters
-
listener The listener to register.
- Since
- 5.8.0
void addWarningsListener | ( | WarningsListener | warningsListener | ) |
Register a warnings listener for this barcode picker.
- Parameters
-
warningsListener The listener to register. If the listener is null, this method has no effect.
- Since
- 5.11.1
void removeWarningsListener | ( | WarningsListener | warningsListener | ) |
Unregister a warnings listener for this barcode picker.
- Parameters
-
warningsListener The listener to unregister. If the listener is null, this method has no effect.
- Since
- 5.11.1
Member Data Documentation
|
static |
The version of the Barcode Scanner SDK.
|
static |
Too much glare warning.
|
static |
Not enough contrast warning.
The documentation for this class was generated from the following file:
- BarcodePicker.java