BarcodeScanner Data Types
BarcodeScanner defines several data types.
An object representing a scanned barcode.
Property Name | Type | Description | Example |
---|---|---|---|
type | BarcodeType | The type of barcode that was recognized. Available values are enumerated in BarcodeScanner.barcodeTypes . |
|
value | String | The decoded value of the barcode. |
|
An object representing configuration details for a barcode scanning session.
Property Name | Type | Description | Example |
---|---|---|---|
barcodeTypes | BarcodeType[] | Optional. Specifies the types of barcodes to scan for. Available values are enumerated in BarcodeScanner.barcodeTypes . Defaults to all supported barcode types. | [myScanner.barcodeTypes.EAN_13, myScanner.barcodeTypes.QR, myScanner.barcodeTypes.DATA_MATRIX] |
instructionText | String | Optional. Provides instructions to display in the scanning interface. Defaults to no text. | "Scan the next item on the shelf" |
successText | String | Optional. Provides a message to display in the scanning interface when a barcode is successfully scanned. Defaults to no text. | "Item scanned" |
showSuccessCheckMark | Boolean | Optional. Indicates whether a check mark is displayed upon a successful scan. Defaults to true . | false |
supportInvertedColors | Boolean | Optional. Indicates whether the barcode scanner attempts to scan barcodes that are printed in inverted colors (for example, white-on-black instead of the standard black-on-white). Android only (ignored on iOS). Defaults to false . Note: By default, Android devices don't support scanning inverted color barcodes. The supportInvertedColors option enables most (not all) Android devices to scan inverted color barcodes. Results may vary when scanning inverted color barcodes. | false |
vibrateOnSuccess | Boolean | Optional. Determines whether the device vibrates when a scan is successful. Defaults to true . | false |
scannerSize | String | Optional. Modifies the size of the scanner camera view. The available options represent a percentage of the user's device screen size.
XLARGE . | "MEDIUM" |
cameraFacing | String | Optional. Specifies whether the front- or rear-facing camera is used. Defaults to "BACK". Available options include "FRONT" and "BACK". If the user's device doesn't support the specified camera facing, an error is returned. | "FRONT" |
backgroundViewHTML | String | Optional. Defines a custom user interface for the scanner instead of using the standard UI. Defaults to null. If nothing is passed in for this parameter, the standard UI is used. If a custom UI is used, it completely replaces the standard UI, including the standard Cancel button used for dismissing the scanner. When defining a custom UI, it's the responsibility of the caller to handle dismissing the scanner. | |
presentWithAnimation | Boolean | Optional. Determines whether the scanner animates in and out when presented and dismissed. Defaults to true . | false |
manualConfirmation | Boolean | Optional. Determines whether the user has to manually confirm that a detected barcode should be scanned. Defaults to false . | true |
previewBarcodeData | Boolean | Optional. Determines whether the scanner displays the barcode data while scanning. Defaults to true . Previewing barcode is only supported when backgroundViewHTML is omitted. | false |
enableBulkScan | Boolean | Optional. Determines whether the scanner collects the results of scanned barcodes before sending them back to the caller. Defaults to false . When set to true , the scanner collects the results of scanned barcodes and displays them on the screen. When the user taps done, the scanned barcode data is sent back to the caller. | true |
enableMultiScan | Boolean | Optional. Determines whether the scanner detects multiple barcodes simultaneously. Defaults to false . Setting this parameter to true automatically sets the enableBulkScan parameter to true . | true |
enableFlashlight | Boolean | Optional. Determines whether the device flashlight should be turned on when scanning barcodes. This takes effect only if cameraFacing is set to back-facing camera. | true |
enableScanLine | Boolean | Optional. When enabled, the scanner UI displays a scan line. Only barcodes touched by this line are detected; others within view are ignored. Defaults to false . | true |
initialZoomFactor | Number | Optional. Determines the initial zoom factor setting for the device's camera. Defaults to 1.0 (1x or no magnification). For frequent scanning of small barcodes, increasing this value to 2.0 or 4.0 launches the scanner with 2x or 4x magnification, respectively, simplifying the process without requiring manual zooming. However, users retain the ability to further adjust the zoom using pinch-to-zoom. Note that if you provide a zoom factor that is outside the min or max range which the device camera supports, then your value is clamped to the min or max zoom factor that's supported by the device camera. | 2.0 |
An object representing an error that occurred when attempting to scan a barcode.
Property Name | Type | Description |
---|---|---|
code | BarcodeScannerFailureCode | A value representing the reason for the scanning failure. Possible codes include the following:
|
message | String | A string value explaining the reason for the scanning failure. This value is suitable for use in user interface messages. The message is provided in English, and isn’t localized. |
userDismissedScanner
is returned when the user clicks the Cancel button during scanning. This is the normal method of terminating a scanning session. Your error handling can check for and possibly treat userDismissedScanner
differently from, for example, permissions errors.