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 or not a check mark is displayed upon a successful scan. Defaults to true . | 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 will automatically set the enableBulkScan parameter to true as well. | true |
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.