Brixxapi allows users to scan barcodes or QR codes with startScanner function. It takes two parameters: control id, it is used to identify on which control the code value will be assigned, and options object in which we pass the bool value for continuous mode. Continuous mode, if true, provides the ability to keep the scanner open after reading code otherwise it will close. The process of reading codes consists of two steps. First step is to use this function. This function needs to be placed under a "Scanner" or "Wedge scanner" controls. When an event is triggered, this function will be called and it will access the camera of the device(if available). Now when it will read a code, this value will be assigned to scanner control in an app. In the second step, we can use this value by using getFieldValue function . It will be used to identify the object depending upon the code and a valueU Starts scanning QR or barcodes with the given scannerControl.
- 1.controlId(String) - The control id of the scanner control (Check scanner control properties in an app).
- 2.scanOptions(JSON Object) - This is a json object with the scanner parameters(Used to specify the scanner functionality):
- continuousMode(Bool - Optional - Default: false) - If true, it will keep the scanner open, after reading a code.
Start scanner with JSON options
Here we are scanning a simpled bar code with a value of '12345678'.
After scanning the code successfully, the value will be assigned to the scanner control present in current app. Now there are many ways to use this value e.g conditionals (if statements). For this tutorial, we will just show the scanned value as a notification by using the code snippet given below. As soon as the scanner scans the code it triggers an "onScan" event. In this event, we can add our customized code.
Code when onScan Event get triggered
As we can see, it is showing the scanned value of '12345678'.