If you use the intel.xdk.device.barcode.scan (XDK Javascript Bridge API) in your app and would like to test on a real mobile with the App Preview, you could see the QRCode reader does not display in your mobile.
Below a few steps to solve (I create a new project):
- create a new project (type : HTML5 + Cordova)
- on the project page, verify that field UI Framework is not "unkown"
- on the project page, uncheck all plugins
- in app.js file write :
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);
- where you want (for exemple in your index.html), write : <script>intel.xdk.device.scanBarcode(); </script>
Aucun commentaire:
Enregistrer un commentaire