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.ScanOverlay Class Reference

Classes

enum  CameraSwitchVisibility
 
enum  GuiStyle
 
enum  MatrixScanState
 

Public Member Functions

void setGuiStyle (GuiStyle guiStyle)
 
Sound Configuration

Customize the scan sound.

void setBeepEnabled (boolean enabled)
 
void setVibrateEnabled (boolean enabled)
 
Torch Configuration

Enable and customize appearance of the torch icon.

void setTorchEnabled (boolean enabled)
 
void setTorchButtonMarginsAndSize (int leftMargin, int topMargin, int width, int height)
 
void setTorchButtonOffAccessibility (String label, String hint)
 
void setTorchButtonOnAccessibility (String label, String hint)
 
Camera Switch Configuration

Enable camera switch and set icons

void setCameraSwitchVisibility (CameraSwitchVisibility visibility)
 
void setCameraSwitchButtonMarginsAndSize (int rightMargin, int topMargin, int width, int height)
 
void setCameraSwitchButtonBackAccessibility (String label, String hint)
 
void setCameraSwitchButtonFrontAccessibility (String label, String hint)
 
Viewfinder Configuration

Customize the viewfinder where the barcode location is highlighted.

void setViewfinderDimension (number width, number height, number landscapeWidth, number landscapeHeight)
 
void setViewfinderColor (String hexColor)
 
void setViewfinderDecodedColor (String hexColor)
 
Search Bar Configuration

Customize the search bar.

void showSearchBar (boolean show)
 
void setSearchBarActionButtonCaption (String caption)
 
void setSearchBarPlaceholderText (String text)
 
Tool Bar Configuration

Customize the tool bar (iOS only).

void setToolBarButtonCaption (String caption)
 
Non-Official Methods
void setProperty (String key, Object value)
 
void setTextRecognitionSwitchVisible (boolean visible)
 
void setMissingCameraPermissionInfoText (String text)
 
void setMatrixScanHighlightingColor (ScanOverlay.MatrixScanState state, String color)
 

Detailed Description

Abstract scan UI class.

The ScanOverlay implements the scan UI displayed on top of the video feed. It is responsible for highlighting barcodes and draw the viewfinder rectangle or laser UI.

Since
4.11.0

Class Documentation

enum Scandit::ScanOverlay::CameraSwitchVisibility

Camera Switch Button Visibility.

Class Members
NEVER The camera switch button is always hidden.
ON_TABLET The camera switch button is shown on tablet devices with front and back cameras.
ALWAYS The camera switch button is shown on all devices that have front and back cameras.
enum Scandit::ScanOverlay::GuiStyle

Scan UI style.

Class Members
DEFAULT A rectangular viewfinder with rounded corners is shown in the specified size.

Recognized codes are marked with four corners.

LASER A laser line is shown with the specified width while the height is not changeable.

This mode should generally not be used if the recognition is running on the whole screen as it indicates that the code should be placed at the location of the laser line.

NONE No UI is shown to indicate where the barcode should be placed.

Be aware that the Scandit logo continues to be displayed as showing it is part of the license agreement.

LOCATIONS_ONLY Like {Scandit.ScanOverlay.GuiStyle.NONE}, but barcode locations are highlighted in the UI.
enum Scandit::ScanOverlay::MatrixScanState

Enumeration of different highlighting state of locations when using matrix scan.

Class Members
LOCALIZED The code has been localized but not yet recognized.
RECOGNIZED The code has been recognized.
REJECTED The code has been visually rejected.

Member Function Documentation

void setBeepEnabled ( boolean  enabled)

Enables (or disables) the sound when a barcode is recognized.

If the phone's ring mode is set to muted or vibrate, no beep will be played regardless of the value.

Enabled by default.

Since
4.11.0
Parameters
enabledWhether the beep is enabled.
void setVibrateEnabled ( boolean  enabled)

Enables or disables the vibration when a code was recognized.

If the phone's ring mode is set to muted, no beep will be played regardless of the value.

Enabled by default.

Since
4.11.0
Parameters
enabledWhether vibrate is enabled.
void setTorchEnabled ( boolean  enabled)

Enables or disables the torch toggle button for all devices/cameras that support a torch.

By default it is enabled. The torch icon is never shown when the camera does not have a torch (most tablets, front cameras, etc).

Since
4.11.0
Parameters
enabledWhether the torch button should be shown.
void setTorchButtonMarginsAndSize ( int  leftMargin,
int  topMargin,
int  width,
int  height 
)

Sets the position at which the button to enable the torch is drawn.

By default the margins are 15 and width and height are 40.

Since
4.11.0
Parameters
leftMarginLeft margin in points.
topMarginTop margin in points.
widthWidth in points.
heightHeight in points.
void setTorchButtonOffAccessibility ( String  label,
String  hint 
)

Sets the accessibility label and hint for the torch button while the torch is off.

The accessibility label and hint give vision-impaired users voice over guidance for the torch button while the torch is turned on. The default label is "Torch Switch (Currently Off)", the default hint "Double-tap to switch the torch on". The hint is only set on iOS devices as Android does not support it.

Since
4.11.0
Parameters
labelThe accessibility label.
hintThe accessibility hint.
void setTorchButtonOnAccessibility ( String  label,
String  hint 
)

Sets the accessibility label and hint for the torch button while the torch is on.

The accessibility label and hint give vision-impaired users voice over guidance for the torch button while the torch is turned on. The default label is "Torch Switch (Currently On)", the default hint "Double-tap to switch the torch off". The hint is only set on iOS devices as Android does not support it.

Since
4.11.0
Parameters
labelThe accessibility label.
hintThe accessibility hint.
void setCameraSwitchButtonMarginsAndSize ( int  rightMargin,
int  topMargin,
int  width,
int  height 
)

Sets the position at which the button to switch the camera is drawn.

By default the margins are 15 and width and height are 40.

Since
4.11.0
Parameters
rightMarginRight margin in dp.
topMarginTop margin in dp.
widthWidth in dp.
heightHeight in dp.
void setCameraSwitchButtonBackAccessibility ( String  label,
String  hint 
)

Sets the accessibility label and hint for the camera switch button while the back-facing camera is active.

The accessibility label and hint give vision-impaired users voice over guidance for the camera switch button while the back-facing camera is active. The default label is "Camera Switch (Currently back-facing)", the default hint "Double-tap to switch to the front-facing camera". The hint is only set on iOS devices as Android does not support it.

Since
4.11.0
Parameters
labelThe accessibility label.
hintThe accessibility hint.
void setCameraSwitchButtonFrontAccessibility ( String  label,
String  hint 
)

Sets the accessibility label and hint for the camera switch button while the front-facing camera is active.

The accessibility label and hint give vision-impaired users voice over guidance for the camera switch button while the front-facing camera is active. The default label is "Camera Switch (Currently front-facing)", the default hint "Double-tap to switch to the back-facing camera". The hint is only set on iOS devices as Android does not support it.

Since
4.11.0
Parameters
labelThe accessibility label.
hintThe accessibility hint.
void setViewfinderDimension ( number  width,
number  height,
number  landscapeWidth,
number  landscapeHeight 
)

Sets the size of the viewfinder relative to the size of the BarcodePicker's size.

Changing this value does not(!) affect the area in which barcodes are successfully recognized. It only changes the size of the box drawn onto the scan screen. To restrict the active scanning area, use the methods listed below.

See also
ScanSettings.setScanningHotSpot(number, number)
ScanSettings.setScanningHotSpotHeight(number)

By default the width is 0.8, height is 0.4, landscapeWidth is 0.6, landscapeHeight is 0.4

Since
4.11.0
Parameters
widthWidth of the viewfinder rectangle in portrait orientation.
heightHeight of the viewfinder rectangle in portrait orientation.
landscapeWidthWidth of the viewfinder rectangle in landscape orientation.
landscapeHeightHeight of the viewfinder rectangle in landscape orientation.
void setViewfinderColor ( String  hexColor)

Sets the color of the viewfinder before a bar code has been recognized.

Note: This feature is only available with the Scandit SDK Enterprise Packages.

By default this is: white (1.0, 1.0, 1.0)

Since
4.11.0
Parameters
hexColorString of the color's hex value ("FF0000" for red, "00FF00" for green).
void setViewfinderDecodedColor ( String  hexColor)

Sets the color of the viewfinder once the bar code has been recognized.

Note: This feature is only available with the Scandit SDK Enterprise Packages.

By default this is: light blue (0.222, 0.753, 0.8)

Since
4.11.0
Parameters
hexColorString of the color's hex value ("FF0000" for red, "00FF00" for green).
void showSearchBar ( boolean  show)

Shows (or hides) a search bar at the top of the scan screen.

The search bar allows the user to manually enter the data of a barcode. When the user finished entering data, the manual callback provided to the {BarcodePicker.show} method is invoked with the entered data as a string. 4.11.0 show Whether the search bar should be visible.

void setSearchBarActionButtonCaption ( String  caption)

Sets the caption of the search button at the top of the numerical keyboard.

By default this is: "Go"

Since
4.11.0
Parameters
captionCaption of the search button.
void setSearchBarPlaceholderText ( String  text)

Sets the text shown in the manual entry field when nothing has been entered yet.

To take effect this has to be called after showSearchBar().

By default this is: "Scan barcode or enter it here"

Since
4.11.0
Parameters
textA placeholder text shown when the search bar is empty.
void setToolBarButtonCaption ( String  caption)

Sets the button caption of the cancel button on the tool bar.

By default this is: "Cancel"

Since
4.13.0
Parameters
captionThe cancel button's caption.
void setProperty ( String  key,
Object  value 
)

Set custom property.

This function is for internal use/and or experimental features and any functionality that can be accessed through it can and will vanish without public notice from one version to the next. Do not use this method unless you specifically have to.

Since
4.11.0
Parameters
keyThe name of the property
valuethe value for the property.
void setTextRecognitionSwitchVisible ( boolean  visible)

Sets whether the button to switch between different recognition modes should be visible.

If The scanner only supports one recognition mode the button is never shown.

Since
5.4
Parameters
visibleWhether the switch should be visible.
void setMissingCameraPermissionInfoText ( String  text)

Sets the text shown if the camera can not be aquired because the app does not have permission to access the camera.

Since
5.4
Parameters
textThe text that is displayed.
void setMatrixScanHighlightingColor ( ScanOverlay.MatrixScanState  state,
String  color 
)

Sets the color of the tracked barcodes to use for the specified state.

Since
5.7
Parameters
stateThe state that uses the specified color.
colorThe color to use for tracked barcodes in the specified state.