[每次我使用QR_CODES功能时,它都会起作用,但是每当使用CODE_39或ALL_FORMATS之类的功能时,由于某种原因,它无法扫描条形码。
public void receiveDetections(Detector.Detections<Barcode> detections) {
final SparseArray<Barcode> detector = detections.getDetectedItems();
if (detector.size() > 0 && detector != null) {
textView.post(new Runnable() {
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
public void run() {
textView.setText(detector.valueAt(0).displayValue);
}
});
} else {
System.out.println("not working");
}
}
扫描仪的供应商和型号是什么?
许多扫描仪允许您通过扫描设置条形码来添加一个字符串,该字符串指示在条形码之前读取/通知的条形码类型。通过识别它,您可以实施仅使用QR码并丢弃其他QR码的过程。
请检查扫描仪的用户手册。