- This topic has 20 replies, 9 voices, and was last updated 9 years, 10 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)
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.
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?
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.
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?
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); }
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.
BrandonMemberThis is usually a permissions error.
Make sure when you build you check the permissions box for external storage.
davidgMemberThanks! that was the problem.
I now takes pictures, Thank you.
BrandonMemberNo problem.
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.
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.
BrandonMemberCheck the Examples, how to forum, I just posted the link, its on my blog.
palani91Membercan u post the full code pls
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