Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use ZXing library without installing barcodescanner app

I have been developing an android app to scan the barcode and QR code and send the results to some other application (HTTP). I have read most of the documentation over internet and here in stack over flow and got it working. I could able to run the stand alone zxing android app on my device, also I could run my own separate android app to use Zxing intent to scan the bar code. But even after reading so many questions here and some of the blogs in internet, I could not get my strict requirements.

I want to achieve following things. 1. I do not want to install a separate barcode scanner app in my device to get my own app to work (to scan the barcode). 2. I used following code

Intent intent = new Intent("com.google.zxing.client.android.SCAN");
startActivityForResult(intent, 0);

and when I run the app in my devide, it asks 'Select the application to complete this action' and it shows 'Google' and 'Google Goggles' and it opens the Google page default camera and scans the barcode. I wanted CaptureActivtiy default capturing page to come (not Google's one) to scan the bar code. 3. I have tried using ZXing in my own app as library but it did not work.

Could you please tell where exactly I am going wrong to get this done ?

like image 387
Raghavendra Nilekani Avatar asked May 08 '13 06:05

Raghavendra Nilekani


2 Answers

I found "zxing" complicated to use. Then I tried with "ZBar Android Version Library". It was so simple. You can download the library from here: http://sourceforge.net/p/zbar/news/2012/03/zbar-android-sdk-version-01-released/

Within the downloaded package, there is a very simple example. Just follow it or include the example to your app. Hopefully your task will be done.

like image 107
shaonAshraf Avatar answered Nov 14 '22 15:11

shaonAshraf


You are showing that you want to integrate by Intent. That's the recommended way to do it, and you can make it even easier, and restrict the list of apps that reply with IntentIntegrator. It's about 5 lines of code: https://code.google.com/p/zxing/wiki/ScanningViaIntent

However this contradicts what you're saying about wanting to implement the scanning in your app. You should clarify what you want.

If that's the case, you need to build your own scanning app, and reuse core.jar and perhaps bits of Barcode Scanner in android/. This is not supported -- you're on your own. Please don't clone our app.

like image 29
Sean Owen Avatar answered Nov 14 '22 17:11

Sean Owen