0

I am developing a simple android app where I need to scan different barcode formats such as Qr code, EAN_8, EAN_13 and Data Matrix. I followed this tutorial Android Barcode Scanner and it works perfectly for scanning Qr code, EAN_8, EAN_13, but it does not work for Data Matrix. What do I have to add in the code to make it work for scanning Data matrix? I suppose I need to have a third button with some code like this: `Button scanner3 = (Button)findViewById(R.id.scanner3); scanner2.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                Intent intent = new Intent("com.google.zxing.client.android.SCAN");
                **intent.putExtra("SCAN_MODE", "PRODUCT_MODE");**
                startActivityForResult(intent, 0);
            }

        });`

But the SCAN_MODE needs to be something else like DATA_MATRIX_MODE... What is the correct syntax?

natt1708
  • 21
  • 1
  • 5

1 Answers1

0

The list of constants in the library has the values listed. For Data Matrix the value is DATA_MATRIX

/** QR Code 2D barcode format. */
public static final BarcodeFormat QR_CODE = new BarcodeFormat("QR_CODE");

/** DataMatrix 2D barcode format. */
public static final BarcodeFormat DATA_MATRIX = new BarcodeFormat("DATA_MATRIX");

/** UPC-E 1D format. */
public static final BarcodeFormat UPC_E = new BarcodeFormat("UPC_E");

/** UPC-A 1D format. */
public static final BarcodeFormat UPC_A = new BarcodeFormat("UPC_A");

/** EAN-8 1D format. */
public static final BarcodeFormat EAN_8 = new BarcodeFormat("EAN_8");

/** EAN-13 1D format. */
public static final BarcodeFormat EAN_13 = new BarcodeFormat("EAN_13");

/** UPC/EAN extension format. Not a stand-alone format. */
public static final BarcodeFormat UPC_EAN_EXTENSION = new BarcodeFormat("UPC_EAN_EXTENSION");

/** Code 128 1D format. */
public static final BarcodeFormat CODE_128 = new BarcodeFormat("CODE_128");

/** Code 39 1D format. */
public static final BarcodeFormat CODE_39 = new BarcodeFormat("CODE_39");

/** Code 93 1D format. */
public static final BarcodeFormat CODE_93 = new BarcodeFormat("CODE_93");

/** CODABAR 1D format. */
public static final BarcodeFormat CODABAR = new BarcodeFormat("CODABAR");

/** ITF (Interleaved Two of Five) 1D format. */
public static final BarcodeFormat ITF = new BarcodeFormat("ITF");

/** RSS 14 */
public static final BarcodeFormat RSS14 = new BarcodeFormat("RSS14");

/** PDF417 format. */
public static final BarcodeFormat PDF417 = new BarcodeFormat("PDF417");

/** RSS EXPANDED */
public static final BarcodeFormat RSS_EXPANDED = new BarcodeFormat("RSS_EXPANDED");
Praveen Paulose
  • 5,741
  • 1
  • 15
  • 19