barcode.scan Event

This event is fired once the barcode reader command has finished doing its job

Description:

The intel.xdk.device.barcode.scan is called once the QR code reader successfully reads a code or once it is cancelled. The event returned with this event contains the following parameters:

Parameter Value
Type always returns "intel.xdk.device.barcode.scan
success true or false depending on whether a QR code was successfully captured or not.
codedata On a successful read, the data embedded in the QR code will be returned here.

Example:


document.addEventListener("intel.xdk.device.barcode.scan", barcodeScanned, false);
function barcodeScanned(evt) {
    intel.xdk.notification.beep(1);
    if (evt.type == "intel.xdk.device.barcode.scan") {
        if (evt.success == true) {
            var url = evt.codedata;
            intel.xdk.device.showRemoteSite(url, 264, 0,56, 48)
        } else {
          //scan cancelled
        }
    }
}
intel.xdk.device.scanBarcode();
          
For more complete information about compiler optimizations, see our Optimization Notice.