- This topic has 20 replies, 9 voices, and was last updated 10 years, 4 months ago by
calosteward.
-
AuthorPosts
-
davidgMemberHi,
I want to integrate a barcode scanner in my app.
I am very new to javascipt and html5 but I came across this javascript code and wanted to see if somebody knew how to make it work.
Here’s a link to the JAVASCRIPT BARCODE Scanner. http://badassjs.com/post/654334959/barcode-scanning-in-javascript
If somebody could get this to work and tell me how to do it that would be awesome. Or if somebody knows a way to integrate a simple barcode scanner, let me know (I would prefer a QR code scanner)
March 20, 2013 at 9:22 pm #336860
welkhansonMemberJavascript barcode scanner? not Java barcode scanner? I know how to integrate barcode reading function into java project. If this experience will help you a little, free to quote me.
March 22, 2013 at 8:19 am #336903
davidgMember@welkhanson wrote:
Javascript barcode scanner? not Java barcode scanner? I know how to integrate barcode reading function into java project. If this experience will help you a little, free to quote me.
Thanks for the reply. Yes, that would be helpful. Do you have any sample mobi projects I could look at?
March 22, 2013 at 8:51 am #336905
BrandonMemberHere is a working sample of the Javascript barcode scanner. It is the code that is by Tobias Schneider, I put it into a Mobione project.
Attachments:
You must be logged in to view attached files.March 28, 2013 at 2:59 pm #337199
davidgMember@CincyPlanet wrote:
Here is a working sample of the Javascript barcode scanner. It is the code that is by Tobias Schneider, I put it into a Mobione project.
Thanks CincyPlanet.
Your demo worked well. However I am trying to retrieve an image taken with the camera and then read the barcode. I have tried using the cordova/phonegap code:
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
destinationType: Camera.DestinationType.FILE_URI });function onSuccess(imageURI) {
var image = document.getElementById(‘myImage’);
image.src = imageURI;
}function onFail(message) {
alert(‘Failed because: ‘ + message);
}But I have not had success retrieving the photo after I take it. It says that there was a compression error.
Have you had any projects where you successfully implemented a camera option?
March 28, 2013 at 3:16 pm #337200
BrandonMemberTry this, will take an image and place it into a image widget where you can read with the barcode sacnner
function captureImage() { navigator.camera.getPicture(onSuccess, onFail, { quality: 50, destinationType: Camera.DestinationType.DATA_URL }); } function onSuccess(imageData) { //Your Image Widget ID below var image = document.getElementById('m1-formName-ImageWidget'); image.src = "data:image/jpeg;base64," + imageData; } function onFail(message) { alert('Failed because: ' + message); }
March 29, 2013 at 10:33 am #337234
davidgMemberThanks CincyPlanet,
I tried the code and it still doesn’t work.
I am using an Android Samsung Galaxy SII and I get the following error after the picture is taken(see attached)
I don’t have the ability to test on the Iphone at this time, but maybe that is the problem.
I did see settings on the phonegap API but I wasn’t able to figure out how to configure so as not to get the error.
Attachments:
You must be logged in to view attached files.March 29, 2013 at 11:02 am #337235
BrandonMemberThis is usually a permissions error.
Make sure when you build you check the permissions box for external storage.March 29, 2013 at 11:17 am #337238
davidgMemberThanks! that was the problem.
I now takes pictures, Thank you.
March 29, 2013 at 11:38 am #337243
BrandonMemberNo problem.
March 29, 2013 at 1:54 pm #337256
BrandonMemberJust a note, I am working on a QR Code creator for M1 right now, actually its working fine, Im writing the tutorial for it.
March 29, 2013 at 2:01 pm #337257
davidgMemberThat’s Great! If you end up posting it on your site I will be sure to check it out. The barcode reader I pieced together works but not very well and it only reads barcodes not QR.
I saw your site and I like it. In a few weeks I will try to give you a few example projects I made that may be helpful to others. Your code examples were helpful to me so I want to try and help out if I can.
March 29, 2013 at 2:19 pm #337259
BrandonMemberCheck the Examples, how to forum, I just posted the link, its on my blog.
November 11, 2013 at 6:49 am #344305
palani91Membercan u post the full code pls
June 26, 2014 at 2:08 am #349932
arronleeMember@welkhanson wrote:
Javascript barcode scanner? not Java barcode scanner? I know how to integrate barcode reading function into java project. If this experience will help you a little, free to quote me.
Hi, welkhanson.
I am also testing about the related projects these days. Do you have any ideas about it? Or any good suggestion? Or could you offer more info about the barcode project you mentioned above? Thanks in advance.Best regards,
Arron -
AuthorPosts