Search code examples
androidzxingbarcode-scanner

Bar Code Scanning


I am using Zxing Lib to scan QR and Bar code. My code is working very well for QR code but unfortunately it is nor working for Bar code.

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

Any help will really appreciable. In my App i can not use InTENTINTEGRATOR

In zxing LIB Following format is provided-

       static final Collection<BarcodeFormat> PRODUCT_FORMATS;
       static final Collection<BarcodeFormat> ONE_D_FORMATS;
       static final Collection<BarcodeFormat> QR_CODE_FORMATS =         EnumSet.of(BarcodeFormat.QR_CODE);
    static final Collection<BarcodeFormat> DATA_MATRIX_FORMATS = EnumSet.of(BarcodeFormat.DATA_MATRIX);
     static {
    PRODUCT_FORMATS = EnumSet.of(BarcodeFormat.UPC_A,
                             BarcodeFormat.UPC_E,
                             BarcodeFormat.EAN_13,
                             BarcodeFormat.EAN_8,
                             BarcodeFormat.RSS_14);
ONE_D_FORMATS = EnumSet.of(BarcodeFormat.CODE_39,
                           BarcodeFormat.CODE_93,
                           BarcodeFormat.CODE_128,
                           BarcodeFormat.ITF);
ONE_D_FORMATS.addAll(PRODUCT_FORMATS);

}


Solution

  • You can try changing the scan mode. Try something like :

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

    or

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

    You can find more info on the following page: https://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/Intents.java