How to decode a QR code

I like to decode the QR code directly in my application, I do not want to redirect my application to another intention. I try very hard to find any API or library from which I can decode the QR code, but I can’t.

Does anyone have an idea how I can decode a QR code in my application or in a library file from which I can decode a QR code.

+8
android qr-code
source share
5 answers

Zxing is a great library for QR codes. You will find what you need, including an android project.

+13
source share

Here is an example of how I manage to decode 1D and 2d QR codes barcodes using the Zxing library in Android.

QR DECODE

Intent intent = new Intent("com.google.zxing.client.android.SCAN"); intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); startActivityForResult(intent, REQUEST_BARCODE); Toast toast = Toast.makeText(this, "Start scanning QR code", Toast.LENGTH_SHORT); toast.show(); 

SECTION BARCODE

  Intent intent = new Intent("com.google.zxing.client.android.SCAN"); intent.putExtra("SCAN_MODE", "PRODUCT_MODE"); startActivityForResult(intent, REQUEST_BARCODE); Toast toast = Toast.makeText(this, "Start scanning Barcode", Toast.LENGTH_SHORT); toast.show(); 

This code works on Android Samsung Galaxy S (version 2.2). If you want to check the different scan modes, check this link: Zxing Intents.java

Best wishes

+6
source share

You can also use the ZBar barcode reader here http://sourceforge.net/projects/zbar/?source=dlp

it is much faster than zxing and much easier to implement.

+4
source share

Now you can use BarcodeDetector in the new Android Mobile Vision API .

Here is an example https://github.com/Gnzlt/AndroidVisionQRReader

+4
source share
 static final String ACTION_SCAN = "com.google.zxing.client.android.SCAN"; // Bar Code public void scanBarCode(View v) { try { //start the scanning activity from the com.google.zxing.client.android.SCAN intent Intent intent = new Intent(ACTION_SCAN); intent.putExtra("SCAN_MODE", "PRODUCT_MODE"); startActivityForResult(intent, 0); } catch (ActivityNotFoundException anfe) { //on catch, show the download dialog showDialog(AndroidBarcodeQrExample.this, "No Scanner Found", "Download a scanner code activity?", "Yes", "No").show(); } } // QR Code public void scanQR(View v) { try { //start the scanning activity from the com.google.zxing.client.android.SCAN intent Intent intent = new Intent(ACTION_SCAN); intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); startActivityForResult(intent, 0); } catch (ActivityNotFoundException anfe) { //on catch, show the download dialog showDialog(AndroidBarcodeQrExample.this, "No Scanner Found", "Download a scanner code activity?", "Yes", "No").show(); } } 
0
source share

All Articles