BarcodeScanner Component


Properties

result
  Gets the text result of the previous scan.
Data type: string
Designer Writable false
Code Writeable false
Code Readable true let variable = barcodescannerName.result

useExternalScanner
  Set whether or not you wish to use an External Scanning program such as Bar Code Scanner. If false a version of ZXing integrated into App Inventor will be used.
Data type: boolean
Designer Writable true <barcodescanner name="barcodescannerName" useExternalScanner="false">
Code Writeable true barcodescannerName.useExternalScanner = false
Code Readable true let variable = barcodescannerName.useExternalScanner

class
  The styling class of the the component
Data type: string
Designer Writable true <barcodescanner name="barcodescannerName" class="Test class">
Code Writeable false
Code Readable false

id
  The styling id of the the component
Data type: string
Designer Writable true <barcodescanner name="barcodescannerName" id="Test id">
Code Writeable false
Code Readable false

name
  The name of the component that will be used to refer to it in code.
Data type: string
Designer Writable true <barcodescanner name="barcodescannerName" name="testComponent">
Code Writeable false
Code Readable false

Methods

Method name Description Parameters
doScan Begins a barcode scan, using the camera. When the scan is complete, the AfterScan event will be raised.
barcodescannerName.doScan()
addEventListener Method used to create event listeners.
See Events below for samples.
eventName string
eventCallbackFunction callback

Events

Event name Description Parameters
afterScan Indicates that the scanner has read a (text) result and provides the result
barcodescannerName.addEventListener(
    "afterScan",
    function (result) {
        //Your code here
    }
)
result string