2

My question is when scanning a pdf417 barcode format sometimes it returns a UPC_E format base on the scan result?

here is a snippet of my code

 private BarcodeView barcodeView;

    private BarcodeCallback callback = new BarcodeCallback() {
            @Override
            public void barcodeResult(BarcodeResult result) {
                if (result.getText() != null) {          
    Toast.makeText(getActivity(), result.getText(), Toast.LENGTH_LONG).show();
                }
            }
            @Override
            public void possibleResultPoints(List<ResultPoint> resultPoints) {
            }
        };

here is the library

compile 'com.journeyapps:zxing-android-embedded:3.3.0'
InsaneCat
  • 2,115
  • 5
  • 21
  • 40
Renz Manacmol
  • 869
  • 12
  • 27

2 Answers2

1

This solved the problem. long time ago :)

private BarcodeCallback callback = new BarcodeCallback() {
            @Override
            public void barcodeResult(BarcodeResult result) {
                if (result.getText() != null) {
                    String barcodeResult = result.getText();
                    String barcodeFormat = result.getBarcodeFormat().toString();
                    if (barcodeFormat.equals("PDF_417")) {
                        try {
                            String barcodeEncodedResult = new ConvertUtil().encodeIntoBase64(barcodeResult);
                            processEncodedResult(barcodeEncodedResult);
                        } catch (UnsupportedEncodingException e) {
                            e.printStackTrace();
                        }
                    } else {
                        Toast.makeText(getActivity(), "Unable to read as PDF_417 barcode format", Toast.LENGTH_LONG).show();
                    }
                }
            }
Renz Manacmol
  • 869
  • 12
  • 27
0

you can pass the format to scan with intent integrator. Something like :

IntentIntegrator integrator = new IntentIntegrator(this); 
integrator.setDesiredBarcodeFormats(IntentIntegrator.PDF_147);
intent = integrator.createScanIntent();
barcodeView.initializeFromIntent(intent);
Randyka Yudhistira
  • 3,612
  • 1
  • 26
  • 41