- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I created an application that needs to scan the bar codes. So i used the intel.xdk.device.scanBarcode() method to realize this function. My problem is that the build of my application doesn't work if i build it with Cordova builder. This is my code:
function BarcodeScanner() {
try {
intel.xdk.device.scanBarcode();
}
catch (err) {
alert(err.message); //This throw "Cannot read property 'scanBarcode' of undefined"
}
}
document.addEventListener("intel.xdk.device.barcode.scan", function (evt) {
intel.xdk.notification.beep(1);
if (evt.success == true) {
artsel = SearchArticoloByBarcode(evt.codedata);
DisplayInfoArt();
ConfArtCheck();
setTimeout(function () { $.ui.scrollToTop("page4", "200") }, 200);
}
else {
alert("Errore lettura");
}
}, false);
The build is successful, but when I run my app I catch an error that says: "Cannot read property 'scanBarcode' of undefined".
If I build the application with legacy builder the app works, but I'd like to use the other builder because the app created is faster and lighter.
The app works also with the Debugger. For now I'm working with an Android Phone (Nexus 5), but the app should run also on iOS and Windows Phone.
Does someone know something about this issue?
Thanks for the help.
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you include the Intel Device plugin? You need to enable that in the Plugins settings, under the Projects Tab in the XDK.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I included that plugin. Futhermore the builder says that the plugin has been installed.
Log File: https://drive.google.com/open?id=0B1GcLTTsayBNTGxfTHREY2xFZjg&authuser=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you try adding a 3rd party cordova barcode scanner and see if that works?
This one appears to be pretty popular http://plugins.cordova.io/#/package/com.phonegap.plugins.barcodescanner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey I have this problem now, can you let me know if you find the solution.
Thank You
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everybody, I'am sorry for the english, but italian school is not good.
However, I have a similar problem: with ios, android, com.phonegap.plugins.barcodescanner
work fine, but if I compile with legacy for Windows Phone, cordova.plugins is undefined.... and then scan failed. I think, but I'm not sure, plugin not deployed.
Any idea? Thanks a lot.
Bye bye from florence.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For Loredano. Dear friend, read on google: many people says is better use com.phonegap.plugins.barcodescanner instead of xdk.device.barcode, becasue is not maintened from Intel.
Bye
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, now I use the cordova plugin for the barcode scanner and I compile in Cordova mode for Androd. With last updates Intel has deprecated the Legacy build, so I decided to re-write the application to compile it in cordova mode. I think this way is better, the app is smoother and ligther.
Bye Bye
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Loredano: but for windows Phone have any idea ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi every body!! I understand the problem. If you build with legacy (example windows phone) thirdy part plugins CANNOT INDLUDES in the project...... Then I come back to xdk.device.scanbarcode for WP8.
Bye
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Correct. The legacy builds do not make use of the Cordova plugins. The legacy builds will soon be removed and you will not be able to build them anymore.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page