Reputation: 1180
I need to implement ZXING QR code scanner in my application. I have complete source code for ZXING Android. Now, I want to use this in my application. my question is that should I copy all ZXING library code in my application including manifest,xml and java files or I can have a jar file which I need to just add in my application? Can anybody tell me how to create jar file from android code, or is any ZXING jar already available which I can just include in my application?
Upvotes: 3
Views: 21986
Reputation: 1891
In Zing library you only need the android/
and the core/ projects
. ZXING library
code doesn't have core.jar
file.
You have to create core.jar file manually from the command line
only (can be a bit tricky) so download core.jar alone
from this link
then need to add the core.jar
file into our project.
add this dependency in app level gradle
'com.google.zxing:core:3.2.0'
REFERENCE site
Upvotes: 1
Reputation: 2179
There is a project in github which was embedded in an android application and it is compatible as android studio project;
https://github.com/journeyapps/zxing-android-embedded
If you live a problem about gradle when you run above project, you can use below project which is same project but there is not any issue about gradle file;
https://bitbucket.org/_oguzhan/ocrandroid
Upvotes: 0
Reputation: 4284
Thats a step by step guide to natively integrating. It integrates the zxing project into yours as a backup of sorts. You will send out an intent request, but your application is registered as a receiver of that request. If the user doesn't have a different scanner, yours will be the only option. If they have other scanners it will allow the user to choose. If you want your app to always be chosen without another option, the comments in the tutorial detail how to change the intent filter to do it.
Keep in mind this is the quick and dirty way to do it. As others have mentioned, ZXing provides a great tutorial on how to send a barcode intent out and point them to the market if they don't have a scanner.
Upvotes: 5
Reputation: 66866
You would never want to copy the android/
code completely. If anything, you want to compile the core/
code, and place the resulting core.jar
in your project's libs/
folder. Then, you have access to the core scanning code in your project.
But, it is far easier to integrate via Intent as Archit says.
Upvotes: 0