Using the Android Barcode Scanner Widget
The barcode detection widget processes frames from the device's camera checking for barcodes. A preview of the camera will be displayed within the widget's bounds, optionally overlaying barcode data when a barcode is detected.
The test stack
This test stack consists of
- an Android Barcode Scanner widget
- a label field
- scrolling field to log the messages sent when a barcode is detected or clicked
- a button to clear the log field
The Card Script
The Card Script contains the handlers for the messages sent by the Barcode Scanner Widget.
on barcodeDetected pBarcode, pID put "Detected:" & arrayToJSON(pBarcode,,true) & tab & pID & return before field "log" end barcodeDetected on barcodeClicked pBarcode put "Clicked:" & arrayToJSON(pBarcode,,true) & return before field "log" end barcodeClicked
Testing on Android
To test the app deploy it to an Android device.
In this example "Select Inclusions" is selected in the Standalone Application Settings to ensure the widget and mergJSON are included because mergJSON is used to display the barcode data in the log field.
When the camera is held over a barcode it will be detected and an overlay will be shown highlighting the barcode area and showing the barcode number. A barcodeDetected message is sent.
This overlay can be customised using the Android Barcode Widget properties.
If the user clicks on the barcode in the widget a barcodeClicked message is sent.
You can find more details on how to use the Android Barcode Scanner in the Guide.