scanBarcode Method

This method will open a full-screen QR code reader in an application

intel.xdk.device.scanBarcode();

Description:

This function will open a full-scren QR code reader in an application. Once it successfully reads a QR code, or the reader is cancelled, the intel.xdk.device.barcode.scan event is called.

Platforms:

Events:

  • intel.xdk.device.barcode.scan: The intel.xdk.device.barcode.scan event is called once the QR code reader successfully reads a code or once it is cancelled.

Example:


document.addEventListener("intel.xdk.device.barcode.scan",function(evt){
        intel.xdk.notification.beep(1);
        if (evt.success == true) {
                //successful scan
                console.log(evt.codedata);

                if (evt.codedata == "http://www.sampleurl.com/fake.html")
                {
                        //in the XDK
                }
                else
                {
                        alert(evt.codedata);
                }
        }else {
                //failed scan
                console.log("failed scan");
        }
},false);
intel.xdk.device.scanBarcode();
                        
For more complete information about compiler optimizations, see our Optimization Notice.