Sunday, November 4, 2012

Creating Your QR Code Scanner and Generator

THIS LIBRARY HAS BEEN DEPRICATED, PLEASE USE BARCODE FRAGMENT LIBRARY V2

Hey Everyone...
Has been long since i posted any of the open source codes which could help you develop some awesome apps.
Well was working on couple of things.. :D

Anyways recently have been working with QR Code scanning and other stuffs...


WHAT IS QR-CODE?
As per wikipedia
QR Code (abbreviated from Quick Response Code) is the trademark for a type of matrix barcode (or two-dimensional code) first designed for the automotive industry. More recently, the system has become popular outside the industry due to its fast readability and large storage capacity compared to standard UPC barcodes. The code consists of black modules (square dots) arranged in a square pattern on a white background. The information encoded can be made up of four standardized kinds ("modes") of data (numeric, alphanumeric, byte/binary,Kanji), or through supported extensions, virtually any kind of data.

We do have several libraries available.. (Many are paid and asks for upto $50k/1000 users and some free (zxing).
Now the obvious question is: WHY ANOTHER LIBRARY?





1. The library is based on Zxing
2. It is based on Fragments which means that you can simply add the scanner functionality in any of your existing application without changing even a single line of code.
3. You can invoke the scanner within a part of screen just like a small view, unlike the existing where you need to launch a new activity all together just to make a scan.

WHERE IS THE LIBRARY?
Here is the link : http://code.google.com/p/barcodefragmentlib/ (depricated)
Please use: https://code.google.com/p/barcodefraglibv2/

HOW TO TEST FUNCTIONALITY?
You can download the apk which has been generated from the provided source.

LICENSE?
As always its under Apache License. So feel free to use.


Lemme know if it helped.

18 comments:

mito said...

Thanks, it works great :)

Only one thing: in startCameraCampure(), the surface is not instantiated instantly, so I had to force hasSurface = false, so it waits for surfaceCreated when it's really created.

I tried to use surfaceHolder.isCreating() but it didn't wokr.

Keep up the good work :)

Ofer said...

Help please,

Imported the lib to my app, but I don't really know what to do next.. tried extending BarCodeFragment but app crashes on startup with NullPointerException on: viewfinderView.setCameraManager(cameraManager);

How exactly do I integrate this with my app after importing the lib?

Shobhit said...

^ Exactly. There is no support for this. I so wanted to use this but was unable to do so because of absence of any documentation. Hope you come up with usage of the library soon. Thanks a lot for creating one.

Ofer said...

Ok, I think I got it,

Try importing the core.jar (xzing core library) from the BarCodeFragmentLib libs library to your own project and add it to your build path. worked for me..

shobhit's world said...

^ As you said, I was able to integrate it but did you receive a response after scanning the code?

shobhit's world said...

^ @Ofer: As you said, I was able to set it up but did not get anything in response after scanning the QR code? Were you able to get it?

Unknown said...

Please check the wiki page for library

The library requires a call back to be registered as IResultCallback.

Once registered with Fragment as setmCallBack the result will be forwarded.

Jann said...

Thanks a lot .. your library is really helpful. :)

But, It worked well in other devices but not S4.
I downloaded the apk from above link & installed on S4 device.
It doesn't work properly like scanning QR code from very far distance and the QR code is becoming small in Camera focus.

Pls guide me how to fix this issue.

Unknown said...

Thanks for the report, i currently don not have a s4, will check and revert. Also adding this as an issue in code.google.com you can check for progress there.

yyouf said...

Hi!
Very nice lib, but a few problems remains, probably due to the lack of documentation(?) :
- I managed to scan QRCode, but impossible to scan a 1D barcode (EAN13)
- camera preview is distoted, depending on the fragment size

Do you have adice for these ?

BTW, nice work ;)

yyouf said...

Hi!
Very nice lib, but a few problems remains, probably due to the lack of documentation(?) :
- I managed to scan QRCode, but impossible to scan a 1D barcode (EAN13)
- camera preview is distoted, depending on the fragment size

Do you have adice for these ?

BTW, nice work ;)

Unknown said...

The current implementation of library only supports QrCode

Anonymous said...

Hi,

I am getting black screen while implemented your code properly. Can you please tell what I am doing wrong. Please help.

Thanks in ADvance or if you have sample working code for it so Please share with me at m.noman.sd@gmail.com

Unknown said...

Dude you have to provide complete code, for example MainActivity and Layout and AndroiManifest. Or all this is useless!!!

Unknown said...

Akshay.. bro please check the latest library i.e V2.. and the complete code is under open source you can check it there.. hope you find it useful now.

Unknown said...

Hi Abhi,

Thanks for your work . It works great .
I managed to scan the EAN_13 and all UPC code formats . But failed in QR code .

It's not scanning QR code in whatever position .
Where i need to fix for this in the library . ?
I am using lib V2 .

Thanks


Unknown said...

Hi Abhi ,

Can you Please help me on scanning QR code .

I'm using Lib V2 . It can scan all code formats except the QR code .

Where i need to look for the changes ?

Thanks

Unknown said...

1-D Barcodes can be scanned only in Landscape orientatoin