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 Cordova

Scandit.BarcodePicker Class Reference

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.

Class Members
PORTRAIT Portrait orientation - for phones this is the natural orientation, for tablets the natural bottom of the device is on the left.
PORTRAIT_UPSIDE_DOWN Upside-down portrait orientation - for phones this is the opposite of the natural orientation, for tablets the natural bottom of the device is on the right.
LANDSCAPE_RIGHT Landscape right orientation - for phones the natural bottom of the device is on the right, for tablets this is the natural orientation.
LANDSCAPE_LEFT Landscape left orientation - for phones the natural bottom of the device is on the left, for tablets this is the opposite of the natural orientation.
enum Scandit::BarcodePicker::State

List of states the picker can be in.

Used as arguments for the didChangeState callback.

Since
4.15
Class Members
STOPPED The picker is in stopped state: the camera preview is off, barcode scanning is off.
ACTIVE The picker is in active state.

The camera preview is running and barcode scanning is active.

PAUSED The picker is in paused state.

The camera preview is running and barcode scanning is inactive.

Member Function Documentation

void show ( Callbacks  callbacks)
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
settingsthe 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
orientationsAn array of BarcodePicker.Orientation objects.
Since
4.11.0
void setMargins ( Margins  portraitMargins,
Margins  landscapeMargins,
number  animationDuration 
)

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
startInPausedStateWhether the scanning process should be paused.
Since
4.11.0
void switchTorchOn ( boolean  on)

Switches the torch on or off.

Parameters
onWhether 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