BarcodeScanner Data Types

BarcodeScanner defines several data types.

An object representing a scanned barcode.

Property NameTypeDescriptionExample
typeBarcodeType (enumeration of type string)The type of barcode that was recognized. Available values are enumerated in BarcodeScanner.barcodeTypes.
  • 'ean13' (the string value of myScanner.barcodeTypes.EAN_13)
  • 'qr' (the string value of myScanner.barcodeTypes.QR)
valueStringThe decoded value of the barcode.
  • '9781984825193'
  • ''

An object representing configuration details for a barcode scanning session.

Property NameTypeDescriptionExample
barcodeTypesBarcodeType[]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]
instructionTextStringOptional. Provides instructions to display in the scanning interface. Defaults to no text.'Scan the next item on the shelf'
successTextStringOptional. Provides a message to display in the scanning interface when a barcode is successfully scanned. Defaults to no text.'Item scanned'
showSuccessCheckMarkBooleanOptional. Indicates whether or not a check mark is displayed upon a successful scan. Defaults to true.false
vibrateOnSuccessBooleanOptional. Determines whether the device vibrates when a scan is successful. Defaults to true.false
scannerSizeStringOptional. Modifies the size of the scanner camera view. The available options represent a percentage of the user's device screen size.
  • SMALL: 25%
  • MEDIUM: 33%
  • LARGE: 50%
  • XLARGE: 75%
Defaults to XLARGE.
cameraFacingStringOptional. 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'
backgroundViewHTMLStringOptional. Defines a custom UI for the scanner instead of using the standard UI. Defaults to none. 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.
presentWithAnimationBooleanOptional. Determines whether the scanner animates in and out when presented and dismissed. Defaults to true.false
manualConfirmationBooleanOptional. Determines whether the user has to manually confirm that a detected barcode should be scanned. Defaults to false.true
previewBarcodeDataBooleanOptional. Determines whether the scanner displays the barcode data while scanning. Defaults to true. Previewing barcode is only supported when backgroundViewHTML is omitted.false
enableBulkScanBooleanOptional. 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
enableMultiScanBooleanOptional. 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 NameTypeDescription
codeBarcodeScannerFailureCode (enumeration of type string)A value representing the reason for the scanning failure. Possible codes include the following:
messageStringA 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.