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 | setGuiStyle (int guiStyle) |
Event Listener Configuration | |
Add and remove listeners for scan events. | |
void | addListener (ScanditSDKListener listener) |
void | removeListener (ScanditSDKListener listener) |
void | removeAllListenes () |
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 | setTorchButtonPosition (float relativeX, float relativeY, int width, int height) |
Camera Switch Configuration | |
Enable camera switch and set icons | |
void | setCameraSwitchVisibility (int visibility) |
void | setCameraSwitchImage (Bitmap image, Bitmap pressedImage) |
void | setCameraSwitchButtonPosition (float invertedRelativeX, float relativeY, int width, int height) |
Viewfinder Configuration | |
Customize the viewfinder where the barcode location is highlighted. | |
void | drawViewfinder (boolean draw) |
void | setViewfinderDimension (float width, float height) |
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) |
void | resetGUI () |
Logo Configuration | |
Customize the scanning by Scandit logo - Note that including the logo in the UI is mandatory. | |
void | setLogoOffsets (int xOffset, int yOffset, int landscapeXOffset, int landscapeYOffset) |
void | setInfoBannerY (float y) |
Searchbar Configuration | |
Customize searchbar appearance | |
void | showSearchBar (boolean show) |
void | setSearchBarPlaceholderText (String text) |
void | setSearchBarKeyboardType (int inputType) |
void | addSearchBarListener (ScanditSDKSearchBarListener listener) |
Deprecated | |
Deprecated methods. | |
void | showTitleBar (boolean show) |
void | showToolBar (boolean show) |
void | showMostLikelyBarcodeUIElement (boolean show) |
void | setTextForInitialScanScreenState (String text) |
void | setTextForBarcodePresenceDetected (String text) |
void | setTextForBarcodeDecodingInProgress (String text) |
void | setTextForMostLikelyBarcodeUIElement (String text) |
void | setTextIfNoBarcodeWasRecognized (String text) |
void | setTextToSuggestManualEntry (String text) |
void | setTitleMessage (String message) |
void | setLeftButtonCaption (String caption) |
void | setLeftButtonCaptionWhenKeypadVisible (String caption) |
void | setRightButtonCaption (String caption) |
void | setRightButtonCaptionWhenKeypadVisible (String caption) |
void | drawViewfinderTextHook (boolean draw) |
Non-Official Methods | |
void | setProperty (String key, Object value) |
Public Attributes | |
int | CAMERA_SWITCH_NEVER |
int | CAMERA_SWITCH_ON_TABLET |
int | CAMERA_SWITCH_ALWAYS |
int | GUI_STYLE_DEFAULT |
int | GUI_STYLE_LASER |
Detailed Description
Interface of all the possible customization options for the standard GUI which is displayed on top of the video feed running the recognition.
Member Function Documentation
void addListener | ( | ScanditSDKListener | listener | ) |
Adds a listener that will receive callbacks for scan events.
- Parameters
-
listener A new listener to add.
void removeListener | ( | ScanditSDKListener | listener | ) |
Removes a listener.
- Parameters
-
listener A listener to be removed.
void removeAllListenes | ( | ) |
Removes all registered listeners.
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
-
guiStyle Must be one of GUI_STYLE_DEFAULT or GUI_STYLE_LASER. By default this is GUI_STYLE_DEFAULT.
- Since
- 4.8.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
- 1.0.0
- Parameters
-
enabled Whether 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
- 1.0.0
- Parameters
-
enabled Whether 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
- 2.0.0
- Parameters
-
enabled Whether 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
- 2.0.0
- Parameters
-
image The 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
- 2.0.0
- Parameters
-
image The new image for when the torch is on. pressedImage The 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
- 2.0.0
- Parameters
-
image The 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
- 2.0.0
- Parameters
-
image The new image for when the torch is off. pressedImage The new image for when the torch is off and it is pressed.
void setTorchButtonPosition | ( | float | relativeX, |
float | relativeY, | ||
int | width, | ||
int | height | ||
) |
Sets the position at which the button to enable the torch is drawn.
The X and Y coordinates are relative to the screen size, which means they have to be between 0 and 1.
By default this is set to x = 0.05, y = 0.01, width = 67, height = 33.
- Since
- 2.0.0
- Parameters
-
relativeX Relative x coordinate. relativeY Relative y coordinate. width Width in pixels. height Height in pixels.
void setCameraSwitchVisibility | ( | int | visibility | ) |
Sets when the camera switch button is visible for devices that have more than one camera.
By default it is CAMERA_SWITCH_NEVER.
- Since
- 3.0.0
- Parameters
-
visibility The visibility of the camera switch button (CAMERA_SWITCH_NEVER, CAMERA_SWITCH_ON_TABLET, CAMERA_SWITCH_ALWAYS)
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). ligh t-tur n-on -icon @2x. png
File needs to be placed in Resources folder.
By default this is: "camera-swap-icon.png" and "camera-swap-icon-pressed.png"
- Since
- 3.0.0
- Parameters
-
image The new image for the camera swap button. pressedImage The new image for the camera swap button when it is pressed.
void setCameraSwitchButtonPosition | ( | float | invertedRelativeX, |
float | relativeY, | ||
int | width, | ||
int | height | ||
) |
Sets the position at which the button to switch the camera is drawn.
The X and Y coordinates are relative to the screen size, which means they have to be between 0 and 1. Be aware that the x coordinate is calculated from the right side of the screen and not the left like with the torch button.
By default this is set to x = 0.05, y = 0.01, width = 67 and height = 33.
- Since
- 3.0.0
- Parameters
-
invertedRelativeX Relative x coordinate (from the right screen edge). relativeY Relative y coordinate. width Width in pixels. height Height in pixels.
void drawViewfinder | ( | boolean | draw | ) |
Shows/hides viewfinder rectangle and highlighted barcode location in the scan screen UI.
Note: This feature is only available with the Scandit SDK Enterprise Packages.
By default this is enabled.
- Since
- 1.0.0
- Parameters
-
draw Whether the viewfinder rectangle should be drawn.
void setViewfinderDimension | ( | float | width, |
float | height | ||
) |
Sets the size of the viewfinder relative to the size of the screen 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.
By default the width is 0.6 and the height is 0.25
- Parameters
-
width Width of the viewfinder rectangle. height Height of the viewfinder rectangle.
void setViewfinderDimension | ( | float | width, |
float | height, | ||
float | landscapeWidth, | ||
float | landscapeHeight | ||
) |
Sets the size of the viewfinder relative to the size of the screen 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
- ScanditSDK::restrictActiveScanningArea(boolean)
- ScanditSDK::setScanningHotSpot(float, float)
- ScanditSDK::setScanningHotSpotHeight(float)
By default the width is 0.8, height is 0.4, landscapeWidth is 0.6, landscapeHeight is 0.4
- Since
- 3.0.0
- Parameters
-
width Width of the viewfinder rectangle in portrait orientation. height Height of the viewfinder rectangle in portrait orientation. landscapeWidth Width of the viewfinder rectangle in landscape orientation. landscapeHeight Height 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
- 1.0.0
- Parameters
-
r Red component (between 0.0 and 1.0). g Green component (between 0.0 and 1.0). b Blue 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
- 1.0.0
- Parameters
-
r Red component (between 0.0 and 1.0). g Green component (between 0.0 and 1.0). b Blue component (between 0.0 and 1.0).
void resetGUI | ( | ) |
Resets the scan screen user interface to its initial state.
This resets any information in the search bar and resets the animation showing the barcode locations to its initial state.
- Since
- 1.0.0
void setLogoOffsets | ( | int | xOffset, |
int | yOffset, | ||
int | landscapeXOffset, | ||
int | landscapeYOffset | ||
) |
Sets the x and y offset at which the Scandit logo should be drawn for both portrait and landscape orientation.
Be aware that the standard Scandit SDK licenses do not allow you to hide the logo.
- Parameters
-
xOffset Offset on the x axis in dip. Default is 0. yOffset Offset on the y axis in dip. Default is 0. landscapeXOffset Offset on the x axis in landscape mode in dip. Default is 0. landscapeYOffset Offset on the y axis in landscape mode in dip. Default is 0.
void setInfoBannerY | ( | float | y | ) |
Sets the y coordinate of the info banner relative to the screen height.
The info banner contains the 'powered by Scandit' logo and the 'most likely barcode' UI element if it is enabled.
- Parameters
-
y The banner's y coordinate relative to the screen size. Default is 0.7.
void showSearchBar | ( | boolean | show | ) |
Shows (or hides) a search bar at the top of the scan screen.
As of 4.0.0 the legacy picker does no longer support a search bar.
- Since
- 1.0.0
- Parameters
-
show Whether the search bar should be visible.
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
By default this is: "Scan barcode or enter it here"
- Since
- 1.0.0
- Parameters
-
text A placeholder text shown when the search bar is empty.
void setSearchBarKeyboardType | ( | int | inputType | ) |
Sets the type of keyboard that is shown when entering characters into the search bar.
- Since
- 1.0.0
- Parameters
-
inputType The new keyboard type. Default is InputType.TYPE_CLASS_NUMBER
void addSearchBarListener | ( | ScanditSDKSearchBarListener | listener | ) |
Add a listener for search bar events.
If the listener is null, or has already been added it is not added to the list of listeners.
- Parameters
-
listener the listener to be added
void showTitleBar | ( | boolean | show | ) |
Adds (or removes) the title bar at the top of the scan screen.
- Since
- 1.0.0
- Parameters
-
show True if a title bar should be shown. Default is true.
void showToolBar | ( | boolean | show | ) |
Adds (or removes) the tool bar at the bottom of the scan screen.
- Since
- 1.0.0
- Parameters
-
show True if a tool bar should be shown. Default is true.
void showMostLikelyBarcodeUIElement | ( | boolean | show | ) |
Add the 'most likely barcode' UI element.
This element is displayed below the viewfinder when the barcode engine is not 100% confident in its result and asks for user confirmation. This element is seldom displayed - typically only when decoding challenging barcodes with fixed focus cameras.
- Since
- 1.0.0
- Parameters
-
show True if the 'most likely barcode' UI element should be shown.
void setTextForInitialScanScreenState | ( | String | text | ) |
Sets the text that will be displayed above the viewfinder to tell the user to align it with the barcode that should be recognized.
- Since
- 1.0.0
- Parameters
-
text The new text. Default is "Align code with box".
void setTextForBarcodePresenceDetected | ( | String | text | ) |
Sets the text that will be displayed above the viewfinder to tell the user to align it with the barcode and hold still because a potential code seems to be on the screen.
- Since
- 1.0.0
- Parameters
-
text The new text. Default is "Align code and hold still".
void setTextForBarcodeDecodingInProgress | ( | String | text | ) |
Sets the text that will be displayed above the viewfinder to tell the user to hold still because a barcode is aligned with the box and the recognition is trying to recognize it.
- Since
- 1.0.0
- Parameters
-
text The new text. Default is "Decoding ...".
void setTextForMostLikelyBarcodeUIElement | ( | String | text | ) |
Sets the text that is displayed alongside the 'most likely barcode' UI element that is displayed when the barcode engine is not 100% confident in its result and asks for user confirmation.
- Since
- 1.0.0
- Parameters
-
text The new text. Default is "Tap to use this likely number".
void setTextIfNoBarcodeWasRecognized | ( | String | text | ) |
Sets the text that is displayed if the engine was unable to recognize the barcode.
- Since
- 1.0.0
- Parameters
-
text The new text. Default is "No barcode recognized".
void setTextToSuggestManualEntry | ( | String | text | ) |
Sets the text that is displayed if the engine was unable to recognize the barcode and it is suggested to enter the barcode manually.
- Since
- 1.0.0
- Parameters
-
text The new text. Default is "Enter barcode via keypad".
void setTitleMessage | ( | String | message | ) |
Sets the title shown at the top of the screen.
- Since
- 1.0.0
- Parameters
-
message The new title message. Default is "Scan a barcode".
void setLeftButtonCaption | ( | String | caption | ) |
Sets the caption of the left button.
- Since
- 1.0.0
- Parameters
-
caption The new button caption. Default is "KEYPAD".
void setLeftButtonCaptionWhenKeypadVisible | ( | String | caption | ) |
Sets the caption of the left button when the keypad is visible.
- Since
- 1.0.0
- Parameters
-
caption The new button caption. Default is "OK".
void setRightButtonCaption | ( | String | caption | ) |
Sets the caption of the right button.
- Since
- 1.0.0
- Parameters
-
caption The new button caption. Default is "CANCEL".
void setRightButtonCaptionWhenKeypadVisible | ( | String | caption | ) |
Sets the caption of the right button when the keypad is visible.
- Since
- 1.0.0
- Parameters
-
caption The new button caption. Default is "CANCEL".
void drawViewfinderTextHook | ( | boolean | draw | ) |
Sets whether to draw the hook at the top of the viewfinder that displays text.
- Since
- 1.0.0
- Parameters
-
draw True if the hook should be drawn. Default is true.
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
-
key The name of the property value the value for the property.
Member Data Documentation
int CAMERA_SWITCH_NEVER |
The camera switch button is always hidden.
int CAMERA_SWITCH_ON_TABLET |
The camera switch button is shown on tablet devices with front and back cameras.
int CAMERA_SWITCH_ALWAYS |
The camera switch button is shown on all devices that have front and back cameras.
int GUI_STYLE_DEFAULT |
The default rectangle with rounded corners is shown.
int GUI_STYLE_LASER |
A laser line is shown.
The documentation for this interface was generated from the following file:
- ScanditSDKOverlay.java