How to decode QR code

前端 未结 5 1603
[愿得一人]
[愿得一人] 2020-12-14 05:31

I like decode QR Code directly in my application, I don\'t wont to redirect my application to other intent. I try very hard to find any API or Library, from which I can deco

5条回答
  •  天涯浪人
    2020-12-14 05:51

    Here is an example how I manage to decode 1D Barcode and 2d QR Codes using Zxing libraryin 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();
    

    BARCODE DECODE

         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 is Working on Android Samsung Galaxy S (Version 2.2). If you want to check different Scan modes check this link: Zxing Intents.java

    Best Regards

提交回复
热议问题