ZXing只识别QR码

时间:2016-01-04 10:35:47

标签: zxing google-glass barcode-scanner

我正在尝试使用ZXing library开发谷歌眼镜条码扫描器(不要判断)。

扫描QR码完美无缺,但我无法扫描任何一维条码。

这是我的代码:

Intent intent = new Intent(this, CaptureActivity.class);
//intent.putExtra("SCAN_MODE", "PRODUCT_MODE"); //doesn't work with or without this line
startActivityForResult(intent, SCAN_REQUEST);

这是一个例子(EAN-8):
enter image description here

使用PlayStore中的扫描仪进行扫描可以在我的手机上进行,但不能在平板电脑上使用我的应用程序。

1 个答案:

答案 0 :(得分:0)

我在 DecodeRunnable.java 中找到了我的问题的解决方法。
通过将BarcodeFormat.EAN_8添加到下面代码中的列表,我能够扫描条形码。< / p>

DecodeHandler() {
  hints = new EnumMap<>(DecodeHintType.class);
  hints.put(DecodeHintType.POSSIBLE_FORMATS,
      Arrays.asList(BarcodeFormat.AZTEC, BarcodeFormat.QR_CODE, BarcodeFormat.DATA_MATRIX));
}

您很乐意发布您的答案,因为我相信有更好的方法来解决这个问题。