Question

My Goal is to use the Intel XDK Barcode scanner using the front camera on the iPhone or iPad. Please help I currently have the simple code snippet

<html>
<head>

  <meta http-equiv="Content-type" content="text/html; charset=utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" />
  <style type="text/css">
    *  { -webkit-user-select:none; -webkit-tap-highlight-color:rgba(0, 0, 0, 0); 
  </style>
  <script src='intelxdk.js'></script>
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>    
  <script type="text/javascript">

    var onDeviceReady=function(){
      //hide splash screen
      intel.xdk.device.hideSplashScreen();
      //intel.xdk.device.scanBarcode();

    };

    document.addEventListener("intel.xdk.device.ready",onDeviceReady,false);    
    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)
            alert(evt.codedata);

        } else {
          //scan cancelled
        }
    }
}

$(document).ready(function(){
    $("#scanBtn").click(function(){
        intel.xdk.device.scanBarcode();
    });   
});
</script>

</head>
<body>
     <a href="javascript:void(0);" id="scanBtn" style="color:red">Scan Now</a>
</body>
</html>
Was it helpful?

Solution

The XDK does not currently support the use of the front camera. Such options will be possible when we are able to support the use of standard Cordova plugins.

Sorry, but I cannot comment on when new features will become available, Intel does not allow public disclosure of roadmaps and schedules.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top