Android - Barcode Scanning, Options? Zxing?

Donal Rafferty picture Donal Rafferty · Apr 9, 2010 · Viewed 21.2k times · Source

I want to create an application for Android that will be able to scan barcodes, get the information contained within the barcode and then be able to use that information in some way.

I have no idea how to create a barcode scanner so I went Googling and it seems Zxing is the most commonly used way to implement a barcode scanner in an app.

Some Links:


http://code.google.com/p/zxing/

http://awalkingcity.com/blog/2008/08/25/qr-codes-made-easy-in-android/

Using ZXing to create an android barcode scanning app


However the samples I found on zxing involved having to prompt the user to go to the market and install the zxing barcode scanner so that my app can then call the barcode scanner when its needed and the barcode scanner will then return the info to my app.

While this would be a good starting point for me I was wondering is there any other options that would allow me to have a barcode scanner embedded in my own application without having to prompt the user to download a secondary application?

Answer

Sean Owen picture Sean Owen · Apr 10, 2010

Developer here. I think you're going to want to just integrate via Intent in the end. You get the improvements, bug fixes, and platform-specific workarounds for free. It's much less code too. But I understand you're asking for an alternative.

You probably want to strip down Barcode Scanner (whose source is in android/ in the project) and strip out everything you don't need. That means leave only about the com.google.zxing.client.android and com.google.zxing.client.android.camera packages. The core decoding is in DecodeThread, but the other code in these packages implements the little callback dance that does the continuous scanning and gets the usual scanning UI.

If you embed the code you need to follow the terms of the Apache License.