koti
koti

Reputation: 3701

Problem in integration of bar code scanner in android

I want to do bar code scanner in android from the link zxing here

But the problem is,it shows camera view but it can't scanning bar code image.I am not understand what is the problem is?Please guide me.

Is there any another procedure rather than above link?

Upvotes: 1

Views: 1948

Answers (1)

RivieraKid
RivieraKid

Reputation: 5961

I had the same problem when I first started using ZXing.

You need to make sure you are requesting the correct barcode format when starting the ZXing activity.

When calling (based on the example)

intent.putExtra("SCAN_MODE", "QR_CODE_MODE");

I'm guessing you actually want to use

intent.putExtra("SCAN_MODE", "PRODUCT_MODE");

Ensure that you include the correct barcode formats as per the Intents.java file:

/**
 * By default, sending Scan.ACTION will decode all barcodes that we understand. However it
 * may be useful to limit scanning to certain formats. Use Intent.putExtra(MODE, value) with
 * one of the values below.
 *
 * Setting this is effectively shorthand for setting explicit formats with {@link #FORMATS}.
 * It is overridden by that setting.
 */
public static final String MODE = "SCAN_MODE";

/**
 * Decode only UPC and EAN barcodes. This is the right choice for shopping apps which get
 * prices, reviews, etc. for products.
 */
public static final String PRODUCT_MODE = "PRODUCT_MODE";

/**
 * Decode only 1D barcodes.
 */
public static final String ONE_D_MODE = "ONE_D_MODE";

/**
 * Decode only QR codes.
 */
public static final String QR_CODE_MODE = "QR_CODE_MODE";

/**
 * Decode only Data Matrix codes.
 */
public static final String DATA_MATRIX_MODE = "DATA_MATRIX_MODE";

/**
 * Comma-separated list of formats to scan for. The values must match the names of
 * {@link com.google.zxing.BarcodeFormat}s, e.g. {@link com.google.zxing.BarcodeFormat#EAN_13}.
 * Example: "EAN_13,EAN_8,QR_CODE"
 *
 * This overrides {@link #MODE}.
 */

Upvotes: 2

Related Questions