Reading barcodes with android - android

Hi I am developing an application for the android htc hero. I am looking into ways of using the inbuilt camer to read 2D barcodes and extract the string returned from the barcode. I have only recently begun working with the android sdk but I do have a programming background from working on projects with java. I am curious to know what the best way to read the 2D barcode would be. I have some sample applications that read the barcode but they are all .apk files and have no source or library that i can work with. to give you a better idea of what i am trying to accomplish this site allows the generation of 2d barcodes made up of the data you desire here
Any replies would be greatly appreciated.

Android programs can interact with eachother using intents. Intents are a little like remote procedure calls: you ask the other program for a certain action (e.g. scan a barcode) and the other program will perform this task for you. The result is returned when the task is complete.
If the user has installed the ZXing Barcode Scanner, you can just use an intent to scan a barcode. The Barcode Scanner will then start, let the user scan the code and return the result to you.
More information about this scanner can be found on the Google Code page of this project: http://code.google.com/p/zxing/wiki/ScanningViaIntent

I'd look at this open source Android project: http://code.google.com/p/zxing/

For fellow Google search travelers, there is a 2012 post on the android developers blog on how to use intents with the example of barcode scanning :
http://android-developers.blogspot.com/2012/02/share-with-intents.html

As far as I know for decoding barcodes (apart from the algorithm) you need to know the (relative) widths of white and black bars. For that, you would have to rotate the barcode to a horizontal position and then detect the widths.
(Ok, the ZXIng stuff advised by others outperforms this manual hacking)

Related

How to integrate barcode scanner into glass app

I have been struggeling with that topic for some time and have no idea how to process further. For first release I don't need even QR code, just simple one.
My glass API is XE22.
I have already tried to use https://github.com/dm77/barcodescanner, I changed screen resolution, but seems just camera is turning on.
When I install apk https://github.com/zxing/zxing/releases/tag/BSGlass-0.2.1 I have the same situation, camera is turning on, but there is no box to scan barcode.
Only app which is working for me is BarcodeEye, but have no idea how to integrate it with my app. When used Intent I get the same message as #nagendra in BarCodeEye QR Cocde Scanner implementation in my application , but when try to use tip from #swooby I get message
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.aa00403.barcodetest/com.example.aa00403.barcodetest.Main}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.github.barcodeeye.SCAN flg=0x4080000 pkg=com.github.barcodeeye (has extras) }
I would be greatefull for any hint, how to do it.
I also wanted to make a barcode scanning application. I tested ZXing and barcodeEye, but I couldn't make them work either.
I found a library that works well made by scandit.
The SDK is not free for commercial use, but there is a community plan you can use to trial the library without time-limit. This free version is limited to QR codes and UPC/Ean though.
I'm actually currently making an app that scans a barcode, looks up the product in the Amazon API, then send the result to a Trello list.
Source is at github. If you just need to scan, look at the ScanActivity.
I hope this will help you! Also, I'm absolutely not an Android/Glass expert developer, so fell free to challenge my code :-)
Disclaimer: I don't work for scandit nor do I know anybody working there.
I have got ZXing working (which is what barcode eyes is based on). But it was a total hack, I didn't so much integrate ZXing with my app as integrate my app into the ZXing sample android app, so I still have all the ZXing source in my project.
However ZXing is not good at scanning small barcodes on glass, and by small I mean, any size you'd ever find on an actual product. It works with really big barcodes (around 10-15cm long) and works fairly well with QR codes.
But Scandit does work way better, as Sylvain mentioned it is paid for commercial but is so much easier and cleaner to integrate and the community edition is free. I'd suggest giving that a try.

Bar code scanner in Android

I want to Create an application which can read the Ba Codes. I want to do this through my on application not using third party applications like 'ZXing'. Please any coding help or tatorial...
I have already done an Android application by scanning directly a barcode with my app. I have used Zxing barcode sources to take functionnalities that I want and it's easy to make your own application which scans barcode.
More particularly, what you have to do is to design a screen which can take photos, then you just need to use the Camera object and when you have an image captured, put it in Bitmap format in parameter of one ZXing method. Then you will have the result and you can display it like you want.
If you have more specific questions about this, don't hesitate to ask. I can retrieve my code to help you.
If you go here: http://code.google.com/p/zxing/wiki/ScanningViaIntent
and follow the explanation, in order to add the class and code described in the site.
Once you've implemented it the scanner added ..
I suggest that you check out the free Scandit barcode scanner SDK for Android. It comes with a step-by-step guide, example code and instructional video how to get started and it also works with low-end Android devices that have no autofocus camera and/or limited resolution.
If you are interested in converting the UPC numbers scanned to product names, there is also a product API.
[Disclaimer: I am a developer at Scandit]

Scan multiple barcodes with ZXing

I am currently trying to get ZXing to scan some barcodes. It's doing that job fine so far (via intent).
Now I would like to make it decode multiple barcodes at once (they are placed beneath each other) without having to scan each barcode individually.
Is this even possible via intent? If not, a short example of how to do it the other way would be appreciated :)
I've so far only found a pretty old thread where a user requested this feature and some developers seem to have integrated it. However, I am unable to find any tutorial explaining the utilization.
The thread can be found here.
It's not possible by Intent, but it is certainly possible within the project. You would have to write your own scanning component, then use the core library's support (which you've found) to find multiple barcodes and do something with them.

Barcode scanner in android

I am developing an barcode scanning application using zxing(in eclipse). I have read many stack overflow threads about developing.
I saw mostly things like, need to use a barcode scanner app for handling the decoding the barcodes and QR-codes.
Is there any option to do that also using the code like capturing the image using camera and then read? We need to create an independent app. Can anyone please help me? Thanks in advance and expecting a detailed reply if possible.
One of the biggest advantages of the Android platform is that you can leverage other apps to provide increased usefulness for yours without a ton of work. In essence yes you could rewrite the bar-code app, but a lot of people will ask why would you want to reinvent the wheel? Now it is true that the zxing process is open source so you can look at their entire program, however I found it more effective to just leverage what was already there.
If you place a check in the program to see if the system can handle the action, you can recommend people get the bar-code scanner to unlock that functionality.
This process is encouraged by the folks at Google. However, as always, you can always try to rewrite it from scratch.

Application which uses camera to focus on QR Code

I need to create an android application which pretty much works like a qr code decoder.
I want to use the android phone camera and read only the qr code from the camera preview, and send it to a decoder library probably zxing which gives me the result. I don't want to use the zxing intent which uses another application barcode scanner.
I am able to take a picture using phone camera, but I don't know how to read only the qr code part from the preview. I need help in this regard and also how to send the data to decoding library.
That's a pretty tall order to ask for here on SO. My advice would be to study the xzing source at http://code.google.com/p/zxing/ and/or see if you can legitimately incorporate it via the Apache 2.0 license into your project.
ok, this turns to be pretty much simple and requires some effort too.
Download the ZXing source code.
There is a CaputureActivity class , which basically initiates the scan and also displays the result.
You have to work on this class to integrate ZXing scanner in to your application, which pretty much looks like it is part of your app.
There is lot more support in the ZXing reader than just scanning QR-codes and more features, which you might want to eliminate , if you would like to have only QR-code scanner.
HTH.

Categories

Resources