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

Marco Matarazzi picture Marco Matarazzi · Aug 29, 2011 · Viewed 21.9k times · Source

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

Answer

user658042 picture user658042 · Aug 29, 2011

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.