views:

268

answers:

2

Hi all,

Sorry if this has been answered before, but I am trying to make an application that will include the ability to scan barcodes on Android. I'm looking at using ZXing as the library, however, I want to embed the scanner in my application so that the user doesn't have to have the ZXing barcode scanner installed to use my application. From the description of ZXing, it sounds like this is possible.

I've gotten as far as building ZXing, linking it into my project in Eclipse, then creating a new reader instance. However, I'm lost when it comes to starting the barcode reader and implementing the callbacks. IMO, this is when the documentation here gets hazy.

If someone could explain how to use ZXing properly, that would be of great help.

Cheers!

+1  A: 

Complete source code to Barcode Scanner is in the android/ directory. That is about the best explanation you could ask for.

If you're rewriting it with new code for your own purpose, I think that's more up to you than for the project to explain.

You might get more useful information at the project discussion group.

Sean Owen
+1  A: 

Personally, I'm a fan of using multiple apps as plug-ins. That way, the user doesn't have to have the same code on the phone multiple times (storage is limited, after all), and - more importantly - if ZXing improves the barcode scanner (which they do often), the user will automatically have the latest and greatest version without you having to integrate and modify it again to fit your needs.

You can simply detect for the presence of the app, and prompt the user to install it if it doesn't exist. You can simply link to the pname: Uri to the zxing app, which will automatically fire up the market and allow the user to install the app.

That said, if you really want to embed the code, one way would be to download the relevant source files, rename the package names and intent names so they don't clash with ZXing's code, and then simply call the intent to scan the barcode (like you would normally do when you use the barcode scanner as a plug-in). If you do that, be sure to credit ZXing for their work in your documentation, and make sure their terms of service allow for using and modifying their source code.

EboMike