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 Xamarin.Android and Data Capture SDK Documentation for Xamarin.iOS

ScanOverlay Interface Referenceabstract

Public Member Functions

void SetGuiStyle (int 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 SetTorchOnImage (Bitmap image)
 
void SetTorchOnImage (Bitmap image, Bitmap pressedImage)
 
void SetTorchOffImage (Bitmap image)
 
void SetTorchOffImage (Bitmap image, Bitmap pressedImage)
 
void SetTorchButtonMarginsAndSize (int leftMargin, int topMargin, int width, int height)
 
void SetTorchOffContentDescription (String contentDescription)
 
void SetTorchOnContentDescription (String contentDescription)
 
Camera Switch Configuration

Enable camera switch and set icons

void SetCameraSwitchVisibility (int visibility)
 
void SetCameraSwitchImage (Bitmap image, Bitmap pressedImage)
 
void SetCameraSwitchButtonMarginsAndSize (int rightMargin, int topMargin, int width, int height)
 
void SetCameraSwitchBackContentDescription (String contentDescription)
 
void SetCameraSwitchFrontContentDescription (String contentDescription)
 
Viewfinder Configuration

Customize the viewfinder where the barcode location is highlighted.

void SetViewfinderDimension (float width, float height, float landscapeWidth, float landscapeHeight)
 
void SetViewfinderColor (float r, float g, float b)
 
void SetViewfinderDecodedColor (float r, float g, float b)
 
abstract void SetMatrixScanHighlightingColor (int state, int color)
 
Non-Official Methods
void SetProperty (String key, Object value)
 

Public Attributes

Camera Switch Button Visibility
const int CameraSwitchNever
 
const int CameraSwitchOnTablet
 
const int CameraSwitchAlways
 
Scan UI style
const int GuiStyleDefault
 
const int GuiStyleLaser
 
const int GuiStyleNone
 
const int GuiStyleMatrixScan
 
const int GuiStyleLocationsOnly
 
Highlighting states of tracked barcodes (MatrixScan)
const int MatrixScanHighlightingStateLocalized
 
const int MatrixScanHighlightingStateRecognized
 
const int MatrixScanHighlightingStateRejected
 

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.

Member Function Documentation

void SetGuiStyle ( int  guiStyle)

The GUI style drawn to display the indicator where the code should be scanned and the visualization of recognized codes.

Parameters
guiStyleMust be one of GuiStyleDefault or GuiStyleDefault. By default this is GuiStyleDefault.
Since
4.9.0
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.9.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.9.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.9.0
Parameters
enabledWhether the torch button should be shown.
void SetTorchOnImage ( Bitmap  image)

Sets the image which is being drawn when the torch is on.

If you want this to be displayed in proper resolution on high resolution screens, you need to provide a resource big enough to work with at least xhdpi resolution.

Since
4.9.0
Parameters
imageThe new image for when the torch is on.
void SetTorchOnImage ( Bitmap  image,
Bitmap  pressedImage 
)

Sets the images which are being drawn when the torch is on.

If you want this to be displayed in proper resolution on high resolution screens, you need to provide a resource big enough to work with at least xhdpi resolution.

Since
4.9.0
Parameters
imageThe new image for when the torch is on.
pressedImageThe new image for when the torch is on and it is pressed.
void SetTorchOffImage ( Bitmap  image)

Sets the image which is being drawn when the torch is off.

If you want this to be displayed in proper resolution on high resolution screens, you need to provide a resource big enough to work with at least xhdpi resolution.

Since
4.9.0
Parameters
imageThe new image for when the torch is off.
void SetTorchOffImage ( Bitmap  image,
Bitmap  pressedImage 
)

Sets the images which are being drawn when the torch is off.

If you want this to be displayed in proper resolution on high resolution screens, you need to provide a resource big enough to work with at least xhdpi resolution.

Since
4.9.0
Parameters
imageThe new image for when the torch is off.
pressedImageThe new image for when the torch is off and it is pressed.
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.7.0
Parameters
leftMarginLeft margin in points.
topMarginTop margin in points.
widthWidth in points.
heightHeight in points.
void SetTorchOffContentDescription ( String  contentDescription)

Sets the content description for the torch button while the torch is off.

The content description gives vision-impaired users voice over guidance for the torch button while the torch is turned off. The default label is "Torch Switch (Currently Off)".

Since
4.9.0
Parameters
contentDescriptionThe content description.
void SetTorchOnContentDescription ( String  contentDescription)

Sets the content description for the torch button while the torch is on.

The content description gives vision-impaired users voice over guidance for the torch button while the torch is turned on. The default label is "Torch Switch (Currently On)".

Since
4.9.0
Parameters
contentDescriptionThe content description.
void SetCameraSwitchVisibility ( int  visibility)

Sets when the camera switch button is visible for devices that have more than one camera.

By default it is CameraSwitchNever.

Since
4.9.0
Parameters
visibilityThe visibility of the camera switch button (CameraSwitchNever, CameraSwitchOnTablet, CameraSwitchAlways)
void SetCameraSwitchImage ( Bitmap  image,
Bitmap  pressedImage 
)

Sets the images which are being drawn when the camera switch button is visible.

If you want this to be displayed in proper resolution on high resolution screens, you need to also provide a resource with the same name but @2x appended and in higher resolution (like flash.nosp@m.ligh.nosp@m.t-tur.nosp@m.n-on.nosp@m.-icon.nosp@m.@2x..nosp@m.png).

File needs to be placed in Resources folder.

By default this is: "camera-swap-icon.png" and "camera-swap-icon-pressed.png"

Since
4.9.0
Parameters
imageThe new image for the camera swap button.
pressedImageThe new image for the camera swap button when it is pressed.
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
3.0.0
Parameters
rightMarginRight margin in dp.
topMarginTop margin in dp.
widthWidth in dp.
heightHeight in dp.
void SetCameraSwitchBackContentDescription ( String  contentDescription)

Sets the content description for the camera switch button while the back-facing camera is active.

The content description gives vision-impaired users voice over guidance for the camera switch button while the back-facing camera is active. The default description is "Camera Switch (Currently back-facing)".

Since
4.9.0
Parameters
contentDescriptionThe content description.
void SetCameraSwitchFrontContentDescription ( String  contentDescription)

Sets the content description for the camera switch button while the front-facing camera is active.

The content description gives vision-impaired users voice over guidance for the camera switch button while the front-facing camera is active. The default description is "Camera Switch (Currently front-facing)".

Since
4.9.0
Parameters
contentDescriptionThe content description.
void SetViewfinderDimension ( float  width,
float  height,
float  landscapeWidth,
float  landscapeHeight 
)

Sets the size of the viewfinder relative to the size of the ScanditBarcodePicker.Android.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.enableRestrictedAreaScanning(boolean)
ScanSettings.setScanningHotSpot(float, float)
ScanSettings.setScanningHotSpotHeight(float)

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

Since
4.9.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 ( float  r,
float  g,
float  b 
)

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.9.0
Parameters
rRed component (between 0.0 and 1.0).
gGreen component (between 0.0 and 1.0).
bBlue component (between 0.0 and 1.0).
void SetViewfinderDecodedColor ( float  r,
float  g,
float  b 
)

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.9.0
Parameters
rRed component (between 0.0 and 1.0).
gGreen component (between 0.0 and 1.0).
bBlue component (between 0.0 and 1.0).
abstract void SetMatrixScanHighlightingColor ( int  state,
int  color 
)
pure virtual

Sets the color of the highlighting in the specified tracking state (MatrixScan).

Since
5.4.0
Parameters
stateA highlighting state. Must be one of MatrixScanHighlightingStateLocalized, MatrixScanHighlightingStateRecognized, MatrixScanHighlightingStateRejected.
colorA color.
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.

Parameters
keyThe name of the property
valuethe value for the property.

Member Data Documentation

const int CameraSwitchNever

The camera switch button is always hidden.

const int CameraSwitchOnTablet

The camera switch button is shown on tablet devices with front and back cameras.

const int CameraSwitchAlways

The camera switch button is shown on all devices that have front and back cameras.

const int GuiStyleDefault

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

Recognized codes are marked with four corners.

const int GuiStyleLaser

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.

const int GuiStyleNone

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.

const int GuiStyleMatrixScan

The MatrixScan UI is shown.

In order to use this UI, it is required to set ScanSettings::setMatrixScanEnabled(bool) to true. Only available on Android API 11 and up.

See also
ScanSettings::setMatrixScanEnabled(bool)
setMatrixScanHighlightingColor(int, int)
Since
5.4.0
const int GuiStyleLocationsOnly

Like GuiStyleNone, but barcode locations are highlighted in the UI.

const int MatrixScanHighlightingStateLocalized

State for tracked barcodes that have been localized, but not recognized yet.

Since
5.4.0
const int MatrixScanHighlightingStateRecognized

State for tracked barcodes that have been recognized.

Since
5.4.0
const int MatrixScanHighlightingStateRejected

State for tracked barcodes that have been rejected with IScanSession.RejectTrackedCode.

Since
5.4.0