Classes | |
enum | Orientation |
enum | State |
Public Member Functions | |
void | show (function didScan, function didManualSearch=null, function didCancel=null, function didRecognizeText=null, function didRecognizeNewCodes=null, function didChangeProperty=null) |
void | show (Callbacks callbacks) |
void | cancel () |
void | applyScanSettings (ScanSettings settings) |
void | setConstraints (Constraints portraitConstraints, Constraints, landscapeConstraints, number animationDuration) |
void | setOrientations (orientations:BarcodePicker.Orientation[]) |
void | setMargins (Margins portraitMargins, Margins landscapeMargins, number animationDuration) |
void | pauseScanning () |
void | resumeScanning () |
void | stopScanning () |
void | startScanning () |
void | startScanning (boolean startInPausedState) |
void | switchTorchOn (boolean on) |
ScanOverlay | getOverlayView () |
Public Attributes | |
boolean | continuousMode |
Orientation[] | orientations |
Detailed Description
The main class for scanning barcodes with the Scandit Barcode Scanner.
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.11.0
Class Documentation
enum Scandit::BarcodePicker::Orientation |
Orientation of the device.
enum Scandit::BarcodePicker::State |
List of states the picker can be in.
Used as arguments for the didChangeState callback.
- Since
- 4.15
Member Function Documentation
void show | ( | function | didScan, |
function | didManualSearch = null , |
||
function | didCancel = null , |
||
function | didRecognizeText = null , |
||
function | didRecognizeNewCodes = null , |
||
function | didChangeProperty = null |
||
) |
Visibly shows the picker to the user.
This should be called after the picker has been fully configured. Once it is shown make sure to call {startScanning()} if you want to start the video feed and scan for barcodes. didScan callback to be invoked whenever codes have been successfully scanned. The callback receives the scan session as the first and only argument which contains a list of recognized codes. didManualSearch callback to be invoked when the user enters a text in the search bar. The entered text is passed as the first argument to the callback. If you do not use the search bar, you may pass null. didCancel callback to be invoked upon failure, or when cancel is called on the picker. The callback is passed a reason for failure as the only argument. didRecognizeText callback to be invoked whenever text has been successfully recognized. The callback receives the { RecognizedText} as the first and only argument.
void show | ( | Callbacks | callbacks | ) |
Visibly shows the picker to the user.
This should be called after the picker has been fully configured. Once it is shown make sure to call {startScanning()} if you want to start the video feed and scan for barcodes. picker.show({ didScan : function(session) {}, ... }) callbacks An object containing one or more callbacks that are invoked when a certain events happens.
void cancel | ( | ) |
Cancels the picker by stopping it and removing it from the screen.
If the picker is not in continuous mode this will happen automatically when a code is recognized.
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.
- Since
- 4.11.0
void setConstraints | ( | Constraints | portraitConstraints, |
Constraints | , | ||
landscapeConstraints | , | ||
number | animationDuration | ||
) |
Sets the view constraints of the barcode picker.
A call to this function causes the barcode picker to be added as a subview on top of the webview instead of as full screen in a new view controller or activity.
Margins, width and height may either be specified using device-independent pixels/points or in percent of the screen size. See {} for details. portraitConstraints Constraints for when the device is in portrait or upside-down portrait orientation. Can be null to indicate no margins and full width and height. landscapeConstraints Constraints for when the device is in landscape left or right orientation. Can be null to indicate no margins and full width and height animationDuration The duration the layout change takes to animate. At 0 it will instantly change. 4.11.0
void setOrientations | ( | orientations:BarcodePicker. | Orientation[] | ) |
Sets the orientations to which the barcode picker is allowed to rotate to.
This only affects the iOS platform. To change the orientation on Android the orientation should be specified in the AndroidManifest.xml.
- Parameters
-
orientations An array of BarcodePicker.Orientation objects.
- Since
- 4.11.0
Sets the margins of the barcode picker.
A call to this function causes the barcode picker to be added as a subview on top of the webview instead of as full screen in a new view controller or activity.
Margins may either be specified using absolute, device-independent pixel units, or in percent of the screen size. See {} for details. portraitMargins Margins for when the device is in portrait or upside-down portrait orientation. Can be null to indicate no margins. landscapeMargins Margins for when the device is in landscape left or right orientation. Can be null to indicate no margins. animationDuration The duration the margin change takes to animate. At 0 it will instantly change. 4.11.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 {} instead. 4.11.0
void resumeScanning | ( | ) |
Asynchronously resume a previously paused scanning process.
Use this method to resume scanning after {} or { pauseScanning} was called. Calling resume on a picker that was not previously started with with startScanning() is undefined. 4.11.0
void stopScanning | ( | ) |
Asynchronously stop the scanning process and camera preview.
- Since
- 4.11.0
void startScanning | ( | ) |
Asynchronously start the camera preview and scanning process.
- Since
- 4.11.0
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.
- Since
- 4.11.0
void switchTorchOn | ( | boolean | on | ) |
Switches the torch on or off.
- Parameters
-
on Whether the torch should be switched on.
- Since
- 4.11.0
ScanOverlay getOverlayView | ( | ) |
Returns the overlay view which contains the main UI.
- Since
- 4.11.0
Member Data Documentation
boolean continuousMode |
Allows to scan multiple codes without closing the scanner.
By default continuousMode is false and the scanner closes after scanning a code.
- Since
- 4.11.0
Orientation [] orientations |
The orientations to which the barcode picker is allowed to rotate to.
- Since
- 4.11.0