QR code scanner

I would like to create a QR code scanner in my application.

I went through zxing, but I could not understand it. I'm only interested in QR codes.

All help is much appreciated.

+8
android zxing
source share
4 answers

Put a copy of the source package com.google.zxing.client. * into your project. You can start the zxing scan operation as follows:

Intent intent = new Intent(this, CaptureActivity.class); startActivityForResult(intent, 0); 

In the same action that you called CaptureActivity, you can process the result when validation is completed using 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.

+10
source share

I know this is an old question, but thought someone might find this helpful.

I recently released a qr reader app, and ZXing is really a go-to library on Android. However, I found working with a copy of the source of the ZXing project complex. There is already a library that processes the ZXing core and even optimizes it for user use.

Try zxing-android-embedded :

  • Super easy to add to your application.
  • It takes care of opening the camera in the background thread for better performance.
  • Has documents / examples for user use of the scanner.
  • Authors respond quickly and commit once every 2 weeks :)

I posted a guide to this post.

Hope this helps!

+3
source share
+2
source share

I did this with a set of plugins, and also added my own add-ons to make it a 1-stop setting.

  • unzip the attached zip file to your project ( https://github.com/chwagssd/qr/archive/master.zip )
  • point to <script src = "path / to / decoder.js"> <script>
  • Create a file entry on your HTML page with an identifier such as "xxx"

     <input type="file" id="xxxx"> 
  • Then tell the page when loading QRIfy into your field! Be sure to include a callback function that will be called with one argument (FULL TEXT that was scanned): QRIfy ('qrCode', onQrCode); // where qrCode is the identifier of your

     <input type="file" id="xxxx"> 

I installed the GIT repo here, grabbed the code (you can download the zip and put it in the javascript folder)

https://github.com/chwagssd/qr

+1
source share

All Articles