API reference for barKoder's Android Barcode Reader SDK
BarkoderView #
The BarkoderView class is part of barKoder's Android Barcode Reader SDK. It provides a variety of methods to control the barcode scanning process. These methods include setting a preview frames callback, manipulating the zoom factor, checking the availability and status of the device's flash, and starting, stopping, or pausing the scanning process. It also allows to set a maximum zoom factor and check whether the device's built-in flash can be used for illumination during barcode scanning. This class provides a granular control over the scanning process, allowing for a highly customizable barcode scanning experience.
setPreviewFramesCallback #
Set the camera frames callback if you only want to receive frames/images without decoding them, allowing you to work with the frames directly. Remember to close the image when finished.
@param previewFramesCallback
fun setPreviewFramesCallback(previewFramesCallback: BarkoderPreviewFramesCallback)
getMaxZoomFactor #
Retrieves the maximum available zoom factor for the device's camera
Zoom factor is received in MaxZoomAvailableCallback
@param callback MaxZoomAvailableCallback
fun getMaxZoomFactor(callback: MaxZoomAvailableCallback)
setZoomFactor #
Sets the zoom factor for the device's camera, adjusting the level of zoom during barcode scanning
@param zoomFactor[1,maxZoomFactor].
fun setZoomFactor(zoomFactor: Int)
isFlashAvailable #
Checks whether the device has a built-in flash (torch) that can be used for illumination during barcode scanning
Result is received in FlashAvailableCallback.
@param callback
fun isFlashAvailable(callback: FlashAvailableCallback)
setFlashEnabled #
Enables or disables the device's flash (torch) for illumination during barcode scanning
@param enabled [true, false].
fun setFlashEnabled(enabled: Boolean)
startScanning #
Initiates the barcode scanning process, allowing the application to detect and decode barcodes from the device's camera feed
@param resultCallback
@throw NullPointerException if BarkoderView config is not set
fun startScanning(resultCallback: BarkoderResultCallback)
stopScanning #
Halts the barcode scanning process, stopping the camera from capturing and processing barcode information
fun stopScanning()
pauseScanning #
Temporarily suspends the barcode scanning process, pausing the camera feed without completely stopping the scanning session
fun pauseScanning()
freezeScanning #
Freezes the AR scanning session by capturing a still image from the camera feed while keeping AR overlays visible.
fun freezeScanning()
unfreezeScanning #
Unfreezes a previously frozen AR scanning session and resumes live camera scanning and overlay updates.
fun unfreezeScanning()
setCamera #
Sets which camera (front or back) is used for scanning.
fun setCamera(position: BarkoderCameraPosition)
getCurrentZoomFactor #
Gets the current zoom factor if the camera is active, or the intended zoom factor that will be applied when the camera starts.
fun getCurrentZoomFactor(): Float
setDynamicExposure #
Configures dynamic exposure compensation based on the provided intensity value.
A value between 0 and 10 is expected, where 0 disables dynamic exposure.
fun setDynamicExposure(intensity: Int)
setCentricFocusAndExposure #
Configures the camera to use the center of the viewfinder for focus and exposure.
fun setCentricFocusAndExposure(enabled: Boolean)
setVideoStabilization #
Enables or disables video stabilization for the camera preview.
fun setVideoStabilization(enabled: Boolean)
captureImage #
Captures the latest available camera frame and returns it through the BarkoderResultDelegate scanningFinished callback (without decoding barcodes).
fun captureImage()
BarkoderConfig #
The BarkoderConfig class is a configuration class for the Barkoder barcode scanning library. It includes methods to set and get various properties like line color and width, region of interest, thread limit, and other characteristics. It provides a highly customizable way for developers to configure their barcode scanning experience, allowing for a wide range of scanning scenarios to be supported.
getDecoderConfig #
Obtain the decoder config object. This object allows you to enable or disable decoders (barcode types) and configure each one individually.
fun getDecoderConfig(): Barkoder.Config
decodingSpeed #
Controls the speed and intensity used for barcode decoding.
Available decoding speeds:
- Fast – fastest performance
- Normal – balanced speed and accuracy
- Slow – more thorough scanning
- Rigorous – deepest, most accurate scanning
decoderConfig setting
var decodingSpeed: DecodingSpeed
formattingType #
Specifies how decoded barcode data should be formatted.
Available formatting modes:
- Disabled – formatting disabled
- Automatic – formatting applied automatically
- GS1 – GS1 formatting rules
- AAMVA – AAMVA formatting for IDs
- SADL – SADL formatting rules
decoderConfig setting
var formattingType: FormattingType
maximumResultsCount #
Sets the maximum number of results that can be returned per scan cycle.
decoderConfig setting
var maximumResultsCount: Int
enableComposite #
Enables recognizing composite barcodes.
decoderConfig setting
var enableComposite: Int
upcEanDeblur #
Improves decoding performance on blurry UPC/EAN barcodes.
decoderConfig setting
var upcEanDeblur: Boolean
enableMisshaped1D #
Enables decoding of distorted or non-standard 1D barcodes.
decoderConfig setting
var enableMisshaped1D: Boolean
enableVINRestrictions #
Enforces restrictions when scanning VIN barcodes.
decoderConfig setting
var enableVINRestrictions: Boolean
encodingCharacterSet #
Sets the character set used to decode text from barcodes.
decoderConfig setting
var encodingCharacterSet: String
dpmMode #
Sets whether Direct Part Marking (DPM) mode is enabled. It's available for QR, Micro QR and Data Matrix barcodes. It only works efficiently with small ROI and camera - it is not efficient for images.
decoderConfig setting
var dpmMode: Boolean
multiPartMerge #
Enables merging of multi-part QR codes into a single result (only returns when all parts are found).
decoderConfig setting
var multiPartMerge: Boolean
setCustomOption #
Sets a custom decoder option by key.
Class: Barkoder
Supported options
"single_line_scan"(1D only): 1 = vertical scan line in the middle, 2 = horizontal scan line in the middle. (scanningIndicator)
"center_only_scan"(1D & 2D): value = center region in %, e.g 1 = exact center, 10 = 10% center area.
"upce_leading_zero": 0 = to remove a leading 0 for UPC-E
"decode_document_image_only": 1 = capture a document image only (no barcode decoding)
// Example: use a custom option in Barkoder
Barkoder.SetCustomOption(bkdView.config.getDecoderConfig(), "single_line_scan", 1);
setLengtRange #
Sets the allowed length range for a particular symbology.
decoderConfig setting.
// Example :
bkdView.config.getDecoderConfig().Code128.setLengthRange(1,100);
checksum #
Controls checksum validation mode:
decoderConfig setting.
StandardChecksum: Disabled / Enabled Code11Checksum: Disabled / Single / Double
Code39Checksum: Disabled / Enabled
MsiChecksum: Disabled / Mod10 / Mod11 / Mod1010 / Mod1110 / Mod11IBM/ Mod111OIMB
getLocationLineColor #
Retrieves the color code representing the line color used to indicate the location of detected barcodes
@return locationLineColor
fun getLocationLineColor(): Int
setLocationLineColor #
Sets the color of the lines used to indicate the location of detected barcodes on the camera feed
@param locationLineColor [valid color representation as integer].
fun setLocationLineColor(locationLineColor: Int)
getLocationLineWidth #
Retrieves the current width setting for the lines indicating the location of detected barcodes on the camera feed
@return float locationLineWidth
fun getLocationLineWidth(): Float
setLocationLineWidth #
Sets the width of the lines indicating the location of detected barcodes on the camera feed
@param float locationLineWidth.
fun setLocationLineWidth(locationLineWidth: Float)
getRoiLineColor #
Retrieves the color code representing the line color of the Region of Interest (ROI) on the camera preview
@return int roiLineColor
fun getRoiLineColor(): Int
setRoiLineColor #
Sets the color of the lines outlining the Region of Interest (ROI) for barcode scanning on the camera feed
@param roiLineColor [valid color representation as integer].
Default value is Color.RED
fun setRoiLineColor(roiLineColor: Int)
getRoiLineWidth #
Retrieves the current width setting for the lines outlining the Region of Interest (ROI) on the camera preview
@return float roiLineWidth
fun getRoiLineWidth(): Float
setRoiLineWidth #
Sets the width of the lines outlining the Region of Interest (ROI) for barcode scanning on the camera feed.
@param roiLineWidth
fun setRoiLineWidth(roiLineWidth: Float)
getRoiOverlayBackgroundColor #
Retrieves the int color code representing the background color of the overlay within the Region of Interest (ROI) on the camera preview
@return int roiOverlayBackgroundColor
fun getRoiOverlayBackgroundColor(): Int
setRoiOverlayBackgroundColor #
Sets the background color of the overlay within the Region of Interest (ROI) for barcode scanning on the camera feed
@param int roiOverlayBackgroundColor [valid color representation as integer].
fun setRoiOverlayBackgroundColor(roiOverlayBackgroundColor: Int)
isCloseSessionOnResultEnabled #
Checks if the session is closed on result enabled
@return Boolean [true,false] ; true if preview will be closed after result, false otherwise
fun isCloseSessionOnResultEnabled(): Boolean
setCloseSessionOnResultEnabled #
Enables or disables the automatic closing of the scanning session upon detecting a barcode result
@param Boolean closeSessionOnResultEnabled [false, true]Default is true
fun setCloseSessionOnResultEnabled(closeSessionOnResultEnabled: Boolean)
isImageResultEnabled #
Check if the image result is enabled.
@return Boolean [true, false];
true if enabled or false if not enabled Image result is received in BarkoderResultCallback as Bitmap
fun isImageResultEnabled(): Boolean
setImageResultEnabled #
Enables or disables the capturing and processing of image data when a barcode is successfully detected.
@param Boolean imageResultEnabled [false, true].
fun setImageResultEnabled(imageResultEnabled: Boolean)
isLocationInImageResultEnabled #
Check if barcode location in the image result is enabled.
If enabled, the barcode in the result image will be marked
@return Boolean [true,false]; true if enabled or false if it’s not enabled
fun isLocationInImageResultEnabled()
setLocationInImageResultEnabled #
Enables or disables the inclusion of barcode location information within the image data result
@param Boolean locationInImageResultEnabled [false, true]. Default is false
fun setLocationInImageResultEnabled(locationInImageResultEnabled: Boolean)
getRegionOfInterest #
Retrieves the region of interest (ROI)
@return Barkoder.BKRect object
fun getRegionOfInterest(): Barkoder.BKRect
setRegionOfInterest #
Defines the Region of Interest (ROI) on the camera preview for barcode scanning, specifying an area where the application focuses on detecting barcodes
@param Float left. Default 3%
@param Float top. Default 20%
@param Float width. Default 94%
@param Float height. Default 60%
@throw IllegalArgumentException if input params are not valid
fun setRegionOfInterest(left: Float, top: Float, width: Float, height: Float)
getThreadsLimit #
Retrieves the threads limit
@return threads number as integer
fun GetThreadsLimit(): Int
SetThreadsLimit #
Sets the threads limit
@param int threadsLimit [1, max threads available]
@throw IllegalArgumentException if input param is greater than maximum threads available on the device
fun SetThreadsLimit(threadsLimit: Int)
isLocationInPreviewEnabled #
Get the value of locationInPreviewEnabled which enables or disabled the display of barcode location information on the camera preview
If enabled, the scanned barcode will be marked on the preview screen for a short time
@return Boolean [true,false]; true if enabled or false if it’s not enabled
fun isLocationInPreviewEnabled(): Boolean
setLocationInPreviewEnabled #
Enables or disables the display of barcode location information on the camera preview
@param Boolean locationInPreviewEnabled [true, false].
fun setLocationInPreviewEnabled(locationInPreviewEnabled: Boolean)
isPinchToZoomEnabled #
Checks if pinch to zoom is enabled
@return Boolean [true,false; ] true if enabled or false if it’s not enabled
fun isPinchToZoomEnabled(): Boolean
setPinchToZoomEnabled #
Enables or disables the pinch-to-zoom feature for adjusting the zoom level during barcode scanning
@param Boolean pinchToZoomEnabled [true, false].
fun setPinchToZoomEnabled(pinchToZoomEnabled: Boolean)
isRegionOfInterestVisible #
Checks if the region of interest (ROI) is visible
@return Boolean [true,false]; true if visible or false otherwise
fun isRegionOfInterestVisible(): Boolean
setRegionOfInterestVisible #
Sets the visibility of the Region of Interest (ROI) on the camera preview
@param Boolean regionOfInterestVisible [true, false].
fun setRegionOfInterestVisible(regionOfInterestVisible: Boolean)
getBarkoderResolution #
Retrieves the resolution for barcode scanning
@return BarkoderResolution object
NORMAL("HD", 1280, 720),
HIGH("Full HD", 1920, 1080);
fun getBarkoderResolution(): BarkoderResolution
setBarkoderResolution #
Sets the resolution for barcode scanning
@param BarkoderResolution barkoderResolution
NORMAL("HD", 1280, 720),
HIGH("Full HD", 1920, 1080);
fun setBarkoderResolution(barkoderResolution: BarkoderResolution)
isBeepOnSuccessEnabled #
Retrieves the value indicating whether a beep sound is played on successful barcode scanning
@return Boolean [true,false]; true if enabled or false if it’s not enabled
fun isBeepOnSuccessEnabled(): Boolean
setBeepOnSuccessEnabled #
Enables or disables the audible beep sound upon successfully decoding a barcode
@param Boolean beepOnSuccess [true, false].
fun setBeepOnSuccessEnabled(beepOnSuccess: Boolean)
isVibrateOnSuccessEnabled #
Retrieves the value indicating whether vibration is enabled on successful barcode scanning
@return Boolean [true,false];
true if enabled or false if it’s not enabled
fun isVibrateOnSuccessEnabled(): Boolean
setVibrateOnSuccessEnabled #
Enables or disables the device vibration upon successfully decoding a barcode.
@param Boolean enabled [true, false].
fun setVibrateOnSuccessEnabled(enabled: Boolean)
setThumbnailOnResultEnabled #
Sets whether to enable barcode thumbnail on result
@param Boolean enabled [true, false].
fun setThumbnailOnResultEnabled(enabled Boolean)
setTresholdBetweenDuplicatesScans #
Sets the threshold between duplicate scans
@param int thresholdBetweenDuplicatesScans.
fun setTresholdBetweenDuplicatesScans(thresholdBetweenDuplicatesScans Int)
getThresholdBetweenDuplicatesScans #
Retrieves the threshold between duplicate scans
return int thresholdBetweenDuplicatesScans
IsMulticodeCachingEnabled #
Retrieves whether multi-code caching is enabled
public static boolean IsMulticodeCachingEnabled() {
return Barkoder.GetGlobalOption(Barkoder.Config.GlobalOption_MulticodeCachingEnabled) == 1;
}
SetMulticodeCachingEnabled #
Sets whether multi-code caching is enabled
public static void SetMulticodeCachingEnabled(boolean enabled) {
Barkoder.SetGlobalOption(Barkoder.Config.GlobalOption_MulticodeCachingEnabled, enabled ? 1 : 0);
}
GetMulticodeCachingDuration #
Retrieves the caching duration (in milliseconds) for multi-code results
public static int GetMulticodeCachingDuration() {
return Barkoder.GetGlobalOption(Barkoder.Config.GlobalOption_MulticodeCachingDuration);
}
SetMulticodeCachingDuration #
Sets the caching duration (in milliseconds) for multi-code results
public static void SetMulticodeCachingDuration(int durationInMS) {
Barkoder.SetGlobalOption(Barkoder.Config.GlobalOption_MulticodeCachingDuration, durationInMS);
}
For a comprehensive understanding of our products and services, we invite you to visit our official website at https://barkoder.com. Our site contains a wealth of information and resources designed to help you better understand how our Barcode Reader SDK can add value to your Android applications.
If you're considering implementing our SDK and would like to understand the potential costs, you can easily request a quote at any time. Our team is always ready to assist you, providing you with detailed and tailored pricing information based on your specific needs. We look forward to the opportunity to work with you!
getScanningIndicatorColor #
Retrieves color of the scanning indicator as Int.
fun getScanningIndicatorColor(): Int
setScanningIndicatorColor #
Set color of the scanning indicator as Int.
fun setScanningIndicatorColor(color: Int)
getScanningIndicatorWidth #
Retrieves width of the scanning indicator as Float.
fun getScanningIndicatorWidth(): Float
setScanningIndicatorWidth #
Default value is 2.0
Sets width of the scanning indicator as Int.
fun setScanningIndicatorWidth(width: Float)
getScanningIndicatorAnimation #
Retrieves scanning indicator animation mode asInt.
fun getScanningIndicatorAnimation(): Int
setScanningIndicatorAnimation #
Sets scanning indicator animation mode asInt.
fun setScanningIndicatorAnimation(scanningIndicatorAnimation: Int)
setScanningIndicatorAlwaysVisible #
Sets whether the scanning indicator is always visible on the camera preview.
fun setScanningIndicatorAlwaysVisible(alwaysShowScanningIndicator: Boolean)
isScanningIndicatorAlwaysVisible #
Retrives isScanningIndicatorAlwaysVisible as Boolean
fun isScanningIndicatorAlwaysVisible(): Boolean
setShowDuplicatesLocations #
Sets whether duplicate barcode locations are shown on the camera preview when the same code is scanned multiple times.
fun setShowDuplicatesLocations(showDuplicatesLocations : Boolean)
getShowDuplicatesLocations #
Rets whether duplicate barcode locations are shown on the camera preview when the same code is scanned multiple times as Boolean
fun getShowDuplicatesLocations(): Boolean
GetVersion #
Retrieves the current version of the Barkoder SDK as a string.
// Example :
Barkoder.GetVersion() -> String
BarkoderARConfig #
arConfig #
Configuration options for AR barcode detection and overlay behavior.
arConfig: BarkoderArConfig
getARMode #
Retrieves the current AR behavior mode.
@return BarkoderARMode arMode
BarkoderARMode getARMode()
setARModeEnabled #
Sets the AR behavior mode.
fun setARModeEnabled(BarkoderARMode ARMode)
getResultDisappearanceDelayMs #
Gets the delay after which AR results expire and disappear from the view.
fun getResultDisappearanceDelayMs(): Int
setResultDisappearanceDelayMs #
Sets the disappearance delay for AR results.
fun setResultDisappearanceDelayMs(resultDisappearanceDelayMS: Int)
getLocationTransitionSpeed #
Gets the overlay transition smoothing speed.
fun getLocationTransitionSpeed(): Float
setLocationTransitionSpeed #
Sets the overlay transition smoothing speed.
fun setLocationTransitionSpeed(speed: Float)
getOverlayRefresh #
Gets the overlay refresh mode.
fun getOverlayRefresh(): BarkoderAROverlayRefresh
setOverlayRefresh #
Sets the overlay refresh mode.
fun setOverlayRefresh(refresh: BarkoderAROverlayRefresh)
getSelectedLocationColor #
Gets the color used for selected barcode outlines.
fun getSelectedLocationColor(): Int
setSelectedLocationColor #
Sets the color used for selected barcode outlines.
fun setSelectedLocationColor(color: Int)
getNonSelectedLocationColor #
Gets the color used for non-selected barcode overlays.
fun getNonSelectedLocationColor(): Int
setNonSelectedLocationColor #
Sets the color used for non-selected barcode overlays.
fun setNonSelectedLocationColor(color: Int)
getSelectedLocationLineWidth #
Gets the line width used for selected barcode outlines.
fun getSelectedLocationLineWidth(): Float
setSelectedLocationLineWidth #
Sets the line width used for selected barcode outlines.
fun setSelectedLocationLineWidth(width: Float)
getNonSelectedLocationLineWidth #
Gets the line width used for non-selected barcode outlines.
fun getNonSelectedLocationLineWidth(): Float
setNonSelectedLocationLineWidth #
Sets the line width used for non-selected barcode outlines.
fun setNonSelectedLocationLineWidth(width: Float)
Gets the AR overlay location type. #
fun getLocationType(): BarkoderARLocationType
setLocationType #
Sets the AR overlay location type.
fun setLocationType(type: BarkoderARLocationType)
isDoubleTapToFreezeEnabled #
Checks if double-tap to freeze is enabled.
fun isDoubleTapToFreezeEnabled(): Boolean
setDoubleTapToFreezeEnabled #
Enables or disables double-tap freeze.
fun setDoubleTapToFreezeEnabled(enabled: Boolean)
isImageResultEnabled #
Checks if image capturing for selected barcodes is enabled.
fun isImageResultEnabled(): Boolean
setImageResultEnabled #
Enables or disables image result capturing.
fun setImageResultEnabled(enabled: Boolean)
isBarcodeThumbnailOnResultEnabled #
Checks if barcode thumbnails are included in AR results.
fun isBarcodeThumbnailOnResultEnabled(): Boolean
setBarcodeThumbnailOnResultEnabled #
Enables or disables thumbnail generation in AR results.
fun setBarcodeThumbnailOnResultEnabled(enabled: Boolean)
getResultLimit #
Gets the maximum number of results allowed.
fun getResultLimit(): Int
setResultLimit #
Sets the maximum number of results allowed.
fun setResultLimit(limit: Int)
getContinueScanningOnLimit #
Checks if scanning continues after reaching the result limit.
fun getContinueScanningOnLimit(): Boolean
setContinueScanningOnLimit #
Sets whether scanning continues after reaching the result limit.
fun setContinueScanningOnLimit(enabled: Boolean)
getEmitResultsAtSessionEndOnly #
Checks if results are emitted only when the session ends.
fun getEmitResultsAtSessionEndOnly(): Boolean
setEmitResultsAtSessionEndOnly #
Sets whether results are emitted only at session end.
fun setEmitResultsAtSessionEndOnly(enabled: Boolean)
getHeaderHeight #
Gets the AR header height.
fun getHeaderHeight(): Float
setHeaderHeight #
Sets the AR header height.
fun setHeaderHeight(height: Float)
getHeaderMaxTextHeight #
Gets the maximum header text height.
fun getHeaderMaxTextHeight(): Float
setHeaderMaxTextHeight #
Sets the maximum header text height.
fun setHeaderMaxTextHeight(height: Float)
getHeaderMinTextHeight #
Gets the minimum header text height.
fun getHeaderMinTextHeight(): Float
setHeaderMinTextHeight #
Sets the minimum header text height.
fun setHeaderMinTextHeight(height: Float)
getHeaderTextColorSelected #
Gets the header text color when a barcode is selected.
fun getHeaderTextColorSelected(): Int
setHeaderTextColorSelected #
Sets the header text color for selected barcodes.
fun setHeaderTextColorSelected(color: Int)
getHeaderTextColorNonSelected #
Gets the header text color when a barcode is not selected.
fun getHeaderTextColorNonSelected(): Int
setHeaderTextColorNonSelected #
Sets the header text color for non-selected barcodes.
fun setHeaderTextColorNonSelected(color: Int)
getHeaderHorizontalTextMargin #
Gets the horizontal text margin inside the header.
fun getHeaderHorizontalTextMargin(): Float
setHeaderHorizontalTextMargin #
Sets the horizontal text margin inside the header.
fun setHeaderHorizontalTextMargin(margin: Float)
getHeaderVerticalTextMargin #
Gets the vertical text margin inside the header.
fun getHeaderVerticalTextMargin(): Float
setHeaderVerticalTextMargin #
Sets the vertical text margin inside the header.
fun setHeaderVerticalTextMargin(margin: Float)
getHeaderTextFormat #
Gets the format string used to display header text.
fun getHeaderTextFormat(): String
setHeaderTextFormat #
Sets the format string used to display header text.
fun setHeaderTextFormat(format: String)
BarkoderHelper #
scanImage #
Scans barcodes from a bitmap image.
fun scanImage(image: Bitmap, config: BarkoderConfig, resultCallback: BarkoderResultCallback, context: Context)
applyConfigSettingsFromTemplate #
Applies configuration parameters from a predefined template.
fun applyConfigSettingsFromTemplate(context: Context, config: BarkoderConfig, template: BarkoderConfigTemplate, callback: BarkoderConfigCallback)
applyConfigSettingsFromURL #
Retrieves configuration properties from a URL and applies them to the provided config.
fun applyConfigSettingsFromURL(config: BarkoderConfig, url: String, callback: BarkoderConfigCallback)
applyConfigSettingsFromFile #
Loads configuration properties from a JSON file path and applies them to the provided config.
fun applyConfigSettingsFromFile(config: BarkoderConfig, filePath: String, callback: BarkoderConfigCallback)
configToJSON #
Exports the provided configuration into a JSON string.
fun configToJSON(config: BarkoderConfig): String?