I would like to create a QR code scanner in my app.
I went through the zxing ,but I could not understand it. I am interested in QR codes only.
All help is hi
I know this is an old question, but thought someone might find this useful.
I recently released a qr reader app, and ZXing really is the go-to library on Android. However, I found working with a copy of the source of ZXing project difficult. There is already a library that handles the ZXing core, and even optimizes it for custom usage.
Try zxing-android-embedded:
I put a guide on this post.
Hope this helps!
I did it using a set of plugins, plus I inserted my own additions to make it a 1-stop setup.
Create a file input in your HTML page that has an id, say "xxx"
<input type="file" id="xxxx">
Then tell the page on load to QRIfy your field! Make sure to include your callback function, which will be called with a single argument (the FULL TEXT that was scanned): QRIfy('qrCode', onQrCode);//where qrCode is the id of your
<input type="file" id="xxxx">
I have setup a GIT repo here, grab the code (you can download the zip and put it in your javascript folder)
https://github.com/chwagssd/qr
There is now an google API for that call Mobile vision.
Code sample: https://github.com/googlesamples/android-vision/tree/master/visionSamples/barcode-reader
Place a copy of the com.google.zxing.client.* source packages into your project. You can start the zxing scanning activity like this:
Intent intent = new Intent(this, CaptureActivity.class);
startActivityForResult(intent, 0);
In the same activity that you invoked the CaptureActivity in you can handle the result when the scan completes with the following onActivityResult method:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (data != null) {
String response = data.getAction();
if(Pattern.matches("[0-9]{1,13}", response)) {
// response is a UPC code, fetch product meta data
// using Google Products API, Best Buy Remix, etc.
} else {
// QR codes - phone #, url, location, email, etc.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(response));
startActivity(intent);
}
}
}
Hope this helps.