The Zxing team rightly point out that integration into your app by integrating source code is not the best code.
REF: http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/
Why?
It means that every time an update is published for Zxing, you will have to copy their updated code and include it within your app, and then publish an update for your own app in turn. There is no guarantee that any updates will be compatible with your current model either.
So that leaves us with intents. See http://code.google.com/p/zxing/wiki/ScanningViaIntent
Zxing have done a great job with this. You have to include a little bit of extra code that elegantly handles the situation if the user does not have Zxing (or an equivalent .e.g. Google Goggles that runs off Zxing oddly enough) installed. It will prompt them to install Zxing if it is not installed and if it is then the app will start.
I personally like this approach because:
- The user has access to the new Zxing app updates immediately without being dependent on me.
- Zxing when launched via intent does not show any branding - so any client that has brand awareness issues should be happy.
- Apart from having to install Zxing if it is not already, the intent method works from a user perspective exactly the same, assuming you launch the scanner in full screen mode as it is by default.
I am not saying it is bad to integrate, I am saying it is probably not the best approach. That said we have found situations where we need the scanning built directly into the app. To do this requires some minor amends to the source (changing a few switch statements to if/else).
Is it legal to do it this way or do we have to use intent?
It is open source so you may do it either way in the end. However I hope that my above experience may deter you from integrating their code with yours.
The code is under Apache Licence V 2.0 and you can read the conditions at http://code.google.com/p/zxing/wiki/LicenseQuestions