Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading barcodes with 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.

like image 932
user233354 Avatar asked Feb 10 '10 21:02

user233354


People also ask

Can I scan barcodes with my Android?

You can scan QR codes on an Android device using the default camera app or the Google Lens app. As long as your Android device has a camera, it should be able to scan any QR code. Once you've scanned a QR code on your Android, you can open the URL or share it. Visit Insider's Tech Reference library for more stories.

How do I enable barcode scanner on Android?

Go to Settings. Select System Apps. Tap on Camera. Then toggle to enable Scan QR codes.

Can I use my phone to read barcodes?

Smart mobile devices have image readers that can decode barcodes and QR codes. In order to enable this functionality, the first step is to download a quality barcode scanning app.

Why can't I scan barcodes with my Android?

Your phone's camera may have trouble scanning the code if it's tilted at an angle. Make sure that it's level with the surface that the code is printed on. If you're holding your phone too close or too far away, it won't scan the code.


2 Answers

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

like image 141
Scharrels Avatar answered Sep 18 '22 09:09

Scharrels


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

like image 30
Mark B Avatar answered Sep 20 '22 09:09

Mark B