Updating library used in phonegap plugin - java

I'm using the BarcodeScanner plugin for phonegap, which uses the Google ZXing library for barcode scanning. I installed this phonegap by using the command cordova plugin add https://github.com/wildabeast/BarcodeScanner in my project directory.
I have edited some code in the ZXing library so that the app uses the front facing camera rather than the rear camera. I need to find a way to update the ZXing library so that my changes would work. Essentially I need a new com.google.zxing.client.android.captureactivity.jar. How exactly do I do that?
Thank you very much in advance.

Related

How to integrate ZXing in Android Studio project so that I can edit code in the Core directory

I've been able to add ZXing by simply adding the dependency in my gradle file, however this doesn't let me edit the code of ZXing.
I'm wanting to access the 2d boolean array that is passed to the Decoder class in ZXing core directory, however to do this I need to edit the code directly.
I tried adding ZXing Core as a module, but as it has no gradle files I could not.
How can I integrate ZXing in this way? (i.e. in such a way that I can edit the files of the library)
In case anyone has the same problem as me, I had to download the source files for ZXing core, create a new android studio project using those downloaded source files, make sure that project compiled smoothly on its own, then in my actual project, I added to the dependencies section of my cradle file:
compile project(":ZXINGPROJECTNAME")
Don't leave out that colon. Worked fine after that

Missing file R.java when creating ZXing library for my app

I'm trying to add the QR scan to my android app. I already know that it's advised to use the Intent method, but the app it's a university project and, therefore, we need to integrate it.
So, I downloaded the pre builded core.jar and the Zxing sources (version 3.0.1), then I created a new Android project with the files in zxing-zxing-3.0.1/android, and then added the core.java in the libs folder and in the build path.
Basically I'm at step 5 of this guide.
The problem is this: my errors do not disappears because the file R.java do not shows up.
I'm using the Android Developing Tools with Eclipse.
R.java is generated by the Android SDK build tools. You didn't build the project yet.
Try these:
look for errors in your layout XML-files
clean your project

zXing runtime error in Android

I'm trying to integrate zXing into my Android app.
I've created a new project from the "android project", set it as a library and insert the core.jar.
I've also have import it the project as a library into my app and insert the core.jar too, but when I launch my Intent, I keep getting this:
RuntimeException: Unable to resume activity
I've read all the posts and tutorials, and I mean it, ALL of them, but I get no solution.
Can anyone help me please?
Kind regards and thanks for advance.
Do one thing change the library project folder to the sdk location for this you have to make one folder which is extensions and then put zxing library file in to it and then import that all library in to you project explorer and then give the reference of library again and you can also follow this below site .....
http://www.androidaz.com/development/zxing-qr-reader-direct-integration

Using Android Library on a Regular Java Project

I am looking to use an android class on a regular non-android java project. Specifically I want to use FaceDetector from android.media
I know that there are OpenCV and other libraries I can use to detect a face in an image but I am looking to use androids library. Is there a way to link androids library to a java project?
Thanks
Go to build path of your java project
Add a new external jar
Browse to the location of your android platform installation
(usually C:\Program Files (x86)\Android)
Under android-sdk\platforms\android-x (where x is the version of android you have) select the android.jar file to add to the project.
Now you have the android library under the referenced libraries, and you can use whatever android classes you want in your java project.
Another way of doing that is to use the android source, get only the java files you need from the android library and put them into your java project. The good thing when you do it this way is that you can modify the code and make it more compatible with your java work.
The android library might contain some calls to the system API's. Look for them before including the library with the above mentioned steps. I would recommend you to look into the documentation of the android library and look for the hooks where it calls android system APIs.Modify the source to use your webcam's API and then include it as a library

how to import ZXING library in android application?

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?
http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/
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.
If all you need to do is scan a barcode...then you can simply do it via intents.
Check this page for a tutorial on scanning via intents.
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
core.3.2.0 download
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
Integrate zxing barcode
QR code using ZXing library
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.
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

Categories