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 Android

Public Member Functions

void setMicroDataMatrixEnabled (boolean enabled)
 
boolean isMicroDataMatrixEnabled ()
 
boolean isForce2dRecognitionEnabled ()
 
void setForce2dRecognitionEnabled (boolean enable)
 
void setHighDensityModeEnabled (boolean enable)
 
boolean isHighDensityModeEnabled ()
 
void setRestrictedAreaScanningEnabled (boolean enable)
 
boolean isRestrictedAreaScanningEnabled ()
 
void setScanningHotSpotHeight (float height)
 
float getScanningHotSpotHeight ()
 
void setActiveScanningArea (int orientation, RectF rect)
 
RectF getActiveScanningArea (int orientation)
 
void setDeviceName (String deviceName)
 
String getDeviceName ()
 
JSONObject toJSON () throws JSONException
 
SymbologySettings getSymbologySettings (int symbology)
 
int getProperty (String key)
 
void setProperty (String key, Object value)
 
void setSymbologyEnabled (int symbology, boolean enabled)
 
boolean isSymbologyEnabled (int symbology)
 
int getCameraFacingPreference ()
 
void setCameraFacingPreference (int preference)
 
void setScanningHotSpot (float x, float y)
 
PointF getScanningHotSpot ()
 
void setRelativeZoom (float zoomPercentage)
 
float getRelativeZoom ()
 
void setMaxNumberOfCodesPerFrame (int maxNumberOfCodesPerFrame)
 
int getMaxNumberOfCodesPerFrame ()
 
boolean isCodeRejectionEnabled ()
 
void setCodeRejectionEnabled (boolean enabled)
 
ScanAreaSettings getAreaSettingsPortrait ()
 
ScanAreaSettings getAreaSettingsLandscape ()
 
void setAreaSettingsLandscape (ScanAreaSettings settings)
 
void setAreaSettingsPortrait (ScanAreaSettings settings)
 
TextRecognitionSettings getTextRecognitionSettings ()
 
void setTextRecognitionSettings (TextRecognitionSettings settings)
 
int getRecognitionMode ()
 
void setRecognitionMode (int recognitionMode)
 
void setMatrixScanEnabled (boolean enabled)
 
boolean isMatrixScanEnabled ()
 
Working Range/Focus Control
void setWorkingRange (int range)
 
int getWorkingRange ()
 
Scan Session Configuration
void setCodeCachingDuration (int duration)
 
int getCodeCachingDuration ()
 
void setCodeDuplicateFilter (int duration)
 
int getCodeDuplicateFilter ()
 

Static Public Member Functions

static ScanSettings create ()
 

Static Public Attributes

Recognition Mode
static final int RECOGNITION_MODE_TEXT
 
static final int RECOGNITION_MODE_CODE
 
static final int RECOGNITION_MODE_CODE_AND_TEXT
 
Focus Working Range
static final int WORKING_RANGE_STANDARD
 
static final int WORKING_RANGE_LONG
 
Camera Facing Direction
static final int CAMERA_FACING_BACK
 
static final int CAMERA_FACING_FRONT
 
Display Orientation
static final int ORIENTATION_LANDSCAPE
 
static final int ORIENTATION_PORTRAIT
 

Detailed Description

Holds settings that affect the recognition of barcodes, such as enabled barcode symbologies, scanning hot spot etc.

Since
4.9.0

Member Function Documentation

void setMicroDataMatrixEnabled ( boolean  enabled)

Enable the detection/decoding of tiny Data Matrix codes.

When this mode is enabled, a dedicated localization algorithm is activated that searches for small Datamatrix codes in the central part of the camera image. This algorithm requires additional resources and slows down the recognition of other barcode symbologies. We recommend using the method only when your application requires the decoding of tiny Datamatrix codes.

By default this mode is disabled.

Parameters
enabledWhether this mode should be enabled.

This feature has been deprecated in 5.2 and no longer has any effect.

boolean isMicroDataMatrixEnabled ( )

setMicroDataMatrixEnabled

Returns
whether micro data matrix mode is enabled

This feature has been deprecated in 5.2 and no longer has any effect.

void setWorkingRange ( int  range)

Sets the focus working range for the barcode picker.

The working range tells the engine at which distance barcodes are to be expected. When set to WORKING_RANGE_STANDARD (the default), the focus is optimized for barcodes close to the camera. When set to WORKING_RANGE_LONG, the focus is optimized for far-away codes.

When using non-standard working range, it is better to directly pass the working range when constructing the barcode picker, because the camera can already start to adjust the focus at an earlier point in time.

The working range hint is ignored on cameras with fixed-focus.

Parameters
rangethe working range
int getWorkingRange ( )

setWorkingRange

Returns
the preferred working range
void setCodeCachingDuration ( int  duration)

Sets the duration (in milliseconds) for which barcodes are kept in the session.

By default, codes are kept for the duration of the session.

Parameters
durationWhen set to values larger than zero, the value is interpreted as milliseconds for which the barcodes should be kept in the session. If set to zero, barcodes are discarded before processing the next frame. Passing -1 will keep the codes for the duration of the scan session.

The default value is -1

int getCodeCachingDuration ( )

setCodeCachingDuration

Returns
the code caching duration in milliseconds
void setCodeDuplicateFilter ( int  duration)

Set the code duplicate filter to the given duration in milliseconds.

Parameters
durationThe duration of the duplicate filter in milliseconds. When set to values larger than zero, barcodes with the same symbology and data are filtered out if they are decoded less than duration milliseconds apart. Set this value to zero, if you do not want to filter duplicates. When set to -1, barcodes are filtered as duplicates if they match an already decoded barcode in the session.

By default, the duplicate filter is set to 500ms

See also
setCodeCachingDuration(int)
int getCodeDuplicateFilter ( )

setCodeDuplicateFilter

Returns
the code duplicate filter in milliseconds
boolean isForce2dRecognitionEnabled ( )

setForce2dRecognitionEnabled

Returns
true when 2d recognition is forced, false if not
void setForce2dRecognitionEnabled ( boolean  enable)

Forces the barcode scanner to always run the 2D decoders (QR, Datamatrix, etc.), even when the 2D detector did not detect the presence of a 2D code.

This slows down the overall scanning speed, but can be useful when your application only tries to read 2D codes. Force 2d recognition is set to on when micro data matrix mode is enabled.

By default, forced 2d recognition is disabled.

Parameters
enable
See also
setMicroDataMatrixEnabled(boolean)
void setHighDensityModeEnabled ( boolean  enable)

Turn on/off high density mode.

High density mode enables phones to work at higher camera resolution, provided they support it. When enabled, phones that are able to run the video preview at 1080p (1920x1080) will use 1080p and not just 720p (1280x720). High density mode gives better decode ranges at the expense of processing speed and allows to decode smaller code in the near range, or codes that further away.

By default, high density mode is disabled.

Parameters
enablewhether high density mode should be enabled
boolean isHighDensityModeEnabled ( )

isHighDensityModeEnabled

Returns
true when high density mode is enabled, false if not
void setRestrictedAreaScanningEnabled ( boolean  enable)

Reduces the area in which barcodes are detected and decoded.

When activated, the active scanning area is defined by setScanningHotSpotHeight(float), setScanningHotSpot(float, float) and setActiveScanningArea(int, RectF)

Parameters
enablewhen true enables active area scanning, when false, disables active area scanning.
boolean isRestrictedAreaScanningEnabled ( )

setRestrictedAreaScanningEnabled

Returns
whether restricted active area scanning is enabled
void setScanningHotSpotHeight ( float  height)

Changes the height of the area where barcodes are decoded in the camera image when restrictActiveScanningArea is activated.

The height of the active scanning area is relative to the height of the screen and has to be between 0.0 and 0.5.

This only applies if the active scanning area is restricted.

The default is 0.25

As of Scandit BarcodeScanner SDK 4.4, the use of this method is discouraged. Use setActiveScanningArea instead.

See also
setRestrictedAreaScanningEnabled(boolean)
setScanningHotSpot(float, float)
Parameters
heightThe relative height of the active scanning area.
float getScanningHotSpotHeight ( )

setScanningHotSpotHeight

Returns
the relative height of the active area.
void setActiveScanningArea ( int  orientation,
RectF  rect 
)

Sets the active scan area for either portrait or landscape mode scanning.

By default, the barcode recognition engine searches the whole image for barcodes. Use this method to define the area in which barcodes are to be searched. Rectangle coordinates run from 0 to 1. The coordinates are relative to the camera preview's width and height.

Calling this method will automatically enable restricted active area scanning (setRestrictedAreaScanningEnabled(boolean)).

Since
4.9.0
Parameters
orientationthe device orientation for which to set the scan area. Must be either ScanSettings.ORIENTATION_LANDSCAPE for landscape orientations (landscape-right and landscape-left), or ScanSettings.ORIENTATION_PORTRAIT for portrait orientations.

Calling this method with other orientation parameters is a no-op.

Parameters
rectthe new active scan area. The coordinates (left, top, right, bottom) are defined as seen by the user.

Invoking this method with invalid rectangles, e.g. rectangles whose top, left, right, or bottom attributes are outside the allowed range of 0.0-1.0, or rectangles with negative width/height will have no effect.

RectF getActiveScanningArea ( int  orientation)

Returns the scan area that is going to be used for the given orientation.

Since
4.9.0
Parameters
orientationthe device orientation. Must either be ScanSettings.ORIENTATION_LANDSCAPE, or ScanSettings.ORIENTATION_PORTRAIT
Returns
The rectangle, or null when orientation is not one of the allowed values. When restricted area scanning is disabled a full-screen area (top=0, left=0, right=1, bottom=1) is returned, otherwise the area from either specifying the scanning hotspot/height or calls to setActiveScanningArea is returned.
See also
setActiveScanningArea
void setDeviceName ( String  deviceName)

Sets the device name to identify the current device when looking at analytics tools.

Sends a request to the server to set this as soon as a connection is available.

Parameters
deviceNameA device name.
String getDeviceName ( )

Returns the device name identifying the current device.

Returns
The device name.
JSONObject toJSON ( ) throws JSONException
Returns
the settings as a json dictionary

There is no guarantee that the JSON dictionary is stable, keys might disappear, be added or renamed without notice.

This feature has been deprecated in 5.10 and returns an empty object. There is no replacement for the functionality thus far.

Since
4.9.0
static ScanSettings create ( )
static
Returns
the default scan settings
SymbologySettings getSymbologySettings ( int  symbology)

Retrieve symbology specific-settings.

Parameters
symbologythe symbology settings to retrieve
Returns
the symbology settings object, or null, if symbology is an invalid symbology.
Since
4.9.0
int getProperty ( String  key)

Get custom property value.

Parameters
keythe name of the property
Returns
the value of the property. For properties have not previously been set on the settings object -1 is returned.
void setProperty ( String  key,
Object  value 
)

Sets a property.

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

Parameters
keyThe property's name.
valueThe property's value.
void setSymbologyEnabled ( int  symbology,
boolean  enabled 
)

Enable/disable decoding of a certain symbology.

This function provides a convenient shortcut to enabling/disabling decoding of a particular symbology without having to go through SymbologySettings.

Some 1d barcode symbologies allow you to encode variable-length data. By default, the Scandit BarcodeScanner SDK only scans barcodes in a certain length range. If your application requires scanning of one of these symbologies, and the length is falling outside the default range, you may need to adjust the "active symbol counts" for the symbology in addition to enabling it. For details on defaults and how to calculate the symbol counts for each symbology, take a look at the barcode length page.

Parameters
symbologyThe symbology to be enabled.
enabledtrue when decoding of the symbology should be enabled, false if not.
Since
4.9.0
boolean isSymbologyEnabled ( int  symbology)

Determine whether decoding of a particular symbology is enabled or not.

Parameters
symbologyThe symbology
Returns
true when decoding of the symbology is enabled, false if not.
int getCameraFacingPreference ( )

setCameraFacingPreference

Returns
ScanSettings.CAMERA_FACING_BACK when the back-facing camera should be preferred, ScanSettings.CAMERA_FACING_FRONT when the front-facing camera should be preferred.
void setCameraFacingPreference ( int  preference)

Set the preferred camera direction.

The picker first gives preference to cameras of the given direction. When the device has no such camera, cameras of the opposite face are tried as well.

By default, the back-facing camera is preferred.

Parameters
preferenceScanSettings.CAMERA_FACING_BACK when the back-facing camera should be preferred, ScanSettings.CAMERA_FACING_FRONT when the front-facing camera should be preferred.
Since
4.9.0
void setScanningHotSpot ( float  x,
float  y 
)

Sets the location in the image where barcodes are decoded with the highest priority.

This method shows a slightly different behavior depending on whether the full screen scanning is active or not. In Full screen scanning mode:

Sets the location in the image which is decoded with the highest priority when multiple barcodes are present in the image.

In restrictActiveScanningArea mode (activated with setRestrictedAreaScanningEnabled(boolean)):

Changes the location of the spot where the barcode decoder actively scans for barcodes.

X and Y can be between 0 and 1, where 0/0 corresponds to the top left corner and 1/1 to the bottom right corner.

The default hotspot is centered on the image (0.5,0.5)

Parameters
xThe hotspot's relative x coordinate.
yThe hotspot's relative y coordinate.
PointF getScanningHotSpot ( )

setScanningHotSpot

Returns
the scanning hot spot
void setRelativeZoom ( float  zoomPercentage)

Sets the zoom to the given percentage of the max zoom possible.

Parameters
zoomPercentageThe percentage of the max zoom (between 0 and 1).
float getRelativeZoom ( )

setRelativeZoom

Returns
the relative zoom
void setMaxNumberOfCodesPerFrame ( int  maxNumberOfCodesPerFrame)

set maximum number of codes to be decoded every frame.

Parameters
maxNumberOfCodesPerFramethe new maximum number of codes.

Setting the maximum number of codes per frame to a high number may have negative impact on performance. Use with caution.

int getMaxNumberOfCodesPerFrame ( )

Get the current maximum number of codes per frame.

Returns
the maximum number of codes per frame. The default is 1.
boolean isCodeRejectionEnabled ( )

Whether code rejection is enabled.

Code rejection allows you to implement custom validation logic for codes in the didScan callback. By default, code rejection is disabled.

Returns
True if code rejection is enabled, false if not.
Since
4.15
void setCodeRejectionEnabled ( boolean  enabled)

Set code rejection enabled/disabled.

Parameters
enabledWhether to enable code rejection
See also
isCodeRejectionEnabled()
Since
4.15
ScanAreaSettings getAreaSettingsPortrait ( )

Obtain the area settings when scanning in portrait orientation.

Returns
The area settings. By default, this getter returns null and the scan areas are controlled by the scanning hotspot, as well as the portrait active scanning area. When this property is set, they override the scanning hot spot, and active scanning area properties.
Since
5.0
ScanAreaSettings getAreaSettingsLandscape ( )

Obtain the area settings when scanning in landscape orientation.

Returns
The area settings. By default, this getter returns null and the scan areas are controlled by the scanning hotspot, as well as the landscape active scanning area. When this property is set, they override the scanning hot spot, and active scanning area properties.
Since
5.0
void setAreaSettingsLandscape ( ScanAreaSettings  settings)

getAreaSettingsLandscape()

Parameters
settingsThe new settings
Since
5.0
void setAreaSettingsPortrait ( ScanAreaSettings  settings)

getAreaSettingsPortrait()

Parameters
settingsThe new settings
Since
5.0
TextRecognitionSettings getTextRecognitionSettings ( )

Get the text recognition settings.

Returns
The text recognition settings. Note that text recognition is not available in the default builds.
void setTextRecognitionSettings ( TextRecognitionSettings  settings)

getTextRecognitionSettings

Parameters
settingsThe new settings
int getRecognitionMode ( )

Get the recognition mode.

Returns
The recognition mode used for the barcode picker.
Since
5.2.0
void setRecognitionMode ( int  recognitionMode)

Sets the recognition mode to use for the barcode picker.

Use this function to programmatically switch between text and barcode recognition. By default, barcode recognition is on (RECOGNITION_MODE_CODE).

Parameters
recognitionModeA recognition mode.
Since
5.2.0
void setMatrixScanEnabled ( boolean  enabled)

Whether MatrixScan should be enabled.

MatrixScan allows you to know the location of all localized codes. In order to get MatrixScan, it is recommended to implement the ProcessFrameDelegate interface and to use ScanSession::getTrackedCodes(). To use the default MatrixScan UI, it is necessary to set ScanOverlay::setGuiStyle(int) to ScanOverlay::GUI_STYLE_MATRIX_SCAN. When implementing a custom MatrixScan UI, it is recommended to set ScanOverlay::setGuiStyle(int) to ScanOverlay::GUI_STYLE_NONE.

Parameters
enabledWhether MatrixScan should be enabled.
Since
5.2.0
boolean isMatrixScanEnabled ( )
Returns
Whether code MatrixScan is enabled.
Since
5.2.0

Member Data Documentation

final int RECOGNITION_MODE_TEXT
static

Text recognition.

final int RECOGNITION_MODE_CODE
static

Barcode/2d code recognition.

final int RECOGNITION_MODE_CODE_AND_TEXT
static

Recognized both text and barcodes/2d codes at the same time.

final int WORKING_RANGE_STANDARD
static

Standard working range.

final int WORKING_RANGE_LONG
static

Long-distance working range.

final int CAMERA_FACING_BACK
static

Default camera orientation - facing away from user.

final int CAMERA_FACING_FRONT
static

Camera facing towards user.

final int ORIENTATION_LANDSCAPE
static

Orientation is either landscape or landscapeReverse.

final int ORIENTATION_PORTRAIT
static

Orientation is either portrait or portraitUpsideDown.


The documentation for this class was generated from the following file:
  • ScanSettings.java