Search code examples
androidandroid-intentbarcodezxing

ZXing how to scan QR-Code AND 1D barcode?


I just imported the ZXing library in my app, I know how to set up the putExtra function to scan QR-Code barcode:

INTENT = new Intent("com.google.zxing.client.android.SCAN");
INTENT.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(INTENT, 0);

and if I like to scan a 1D barcode:

INTENT = new Intent("com.google.zxing.client.android.SCAN");
INTENT.putExtra("SCAN_MODE", "PRODUCT_MODE");
startActivityForResult(INTENT, 0);

but how do I make the App able to scan both?? (1D and 2D barcode).

Thanks! Marco


Solution

  • If you just want to scan both (and not exclusively these two):

    Don't add the SCAN_MODE extra to the intent. Thats optional to limit the type of barcode to a certain type. Not specifying it will scan all possible types.