b1zantine / ZXing-Orient

An Barcode Scanner Library based on the ZXing Library with support for Portrait Orientation.
Apache License 2.0
74 stars 24 forks source link

Unable to scan normal barcodes except QR codes. #9

Open YogeshPatel1994 opened 8 years ago

YogeshPatel1994 commented 8 years ago

Could not use the code to scan normal "barcodes" instead of QR codes.

b1zantine commented 8 years ago

By default it supports only certain types of codes.

Start the activity like this to use 1D bar codes alone

new ZxingOrient(MainActivity.this).initiateScan(Barcode.ONE_D_CODE_TYPES);

To use 2D barcodes alone

new ZxingOrient(MainActivity.this).initiateScan(Barcode.TWO_D_CODE_TYPES);

To detect specific barcodes types only

new ZxingOrient(MainActivity.this)
    .initiateScan(new Collections.unmodifiableList(Arrays.asList("QR_CODE", "DATA_MATRIX","UPC_A", "UPC_E", "EAN_8")));

For other barcode types have a look into Barcode.java

YogeshPatel1994 commented 8 years ago

2D barcodes' code snippet is working perfectly, only 1Ds' code is not working and barcodes are not getting detected.

b1zantine commented 8 years ago

can you post some details about your phone model and the code you used if possible

YogeshPatel1994 commented 8 years ago

As mentioned in the code given here, I made a switch case like this for 1D scan: switch (v.getId()){ case R.id.button_1: new ZxingOrient(HomeActivity.this) .setIcon(R.drawable.ic_launcher) .setInfo("Scans 1D barcodes") .initiateScan(Barcode.ONE_D_CODE_TYPES); break; case R.id.button_2: new ZxingOrient(HomeActivity.this) .setIcon(R.drawable.ic_launcher) .setInfo("Scans 2D barcodes") .initiateScan(Barcode.TWO_D_CODE_TYPES); }