简体   繁体   English

无法使用 Scandit SDK 扫描某些条码 - Android

[英]Unable to scan some barcodes with Scandit SDK - Android

My code is scanning codes of a certain length but if the length is increased it doesn't scan and I don't know how to increase the length of characters of barcode.我的代码正在扫描一定长度的代码,但如果长度增加,它不会扫描,我不知道如何增加条码的字符长度。 I did check the following question but wasn't sure how to use it in my code:我确实检查了以下问题,但不确定如何在我的代码中使用它:

Scandit not recognizing a barcode Scandit 无法识别条形码

Here is my current code:这是我当前的代码:

    private void showCameraScannerInMatrixMode(){
    stopScanner();
    ScanSettings settings = ScanSettings.create();
    int[] symbologiesToEnable = new int[] {
            Barcode.SYMBOLOGY_CODE128
    };

    for (int sym : symbologiesToEnable) {
        settings.setSymbologyEnabled(sym, true);
    }


    settings.setMatrixScanEnabled(true);
    settings.setMaxNumberOfCodesPerFrame(10);
    settings.setCodeRejectionEnabled(true);
    float zoomLevelInPrefs = (float)PreferenceHelper.getIntFromPreferences(Constants.INLINE_SCANDIT_SCANNER_ZOOM_CONFIG,getApplicationContext());
    float zoomLevel = zoomLevelInPrefs / 100;
    settings.setRelativeZoom(zoomLevel);
    settings.setCameraFacingPreference(ScanSettings.CAMERA_FACING_BACK);

    boolean emulatePortraitMode = !BarcodePicker.canRunPortraitPicker();
    if (emulatePortraitMode) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }
    scanTextOverlay.setVisibility(View.VISIBLE);
    mBarcodePicker = (BarcodePicker)findViewById(R.id.scannerView);
    mBarcodePicker.setOnScanListener(this);
    mBarcodePicker.applyScanSettings(settings);
    mBarcodePicker.setVisibility(View.VISIBLE);
    mBarcodePicker.getOverlayView().setGuiStyle(ScanOverlay.GUI_STYLE_MATRIX_SCAN);
    mBarcodePicker.getOverlayView().setVibrateEnabled(false);
    mBarcodePicker.setOnScanListener(this);
    mBarcodePicker.startScanning();
}

Here is the barcode that I am able to scan这是我可以扫描的条形码这是我可以扫描的条形码

This I am unable to scan这是我无法扫描的这是我无法扫描的

The relevant documentation for this is under https://docs.scandit.com/stable/android/android-active-symbols-counts.html what you should be doing in your case (you have a code with length 19 and one with length 22):相关文档在https://docs.scandit.com/stable/android/android-active-symbols-counts.html你应该在你的情况下做什么(你有一个长度为 19 的代码和一个长度为22):

SymbologySettings symSettings = 
settings.getSymbologySettings(Barcode.SYMBOLOGY_CODE128);
short[] activeSymbolCounts = new short[] {
    7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22
};
symSettings.setActiveSymbolCounts(activeSymbolCounts);

If you aren't interested in shorter codes you might want to start a bit higher than 7. As the guide states you can download the Scandit Demo app at https://play.google.com/store/apps/details?id=com.scandit.demoapp to figure out the length of each code (just go into the "Any Code" mode and scan a barcode).如果您对更短的代码不感兴趣,您可能希望从略高于 7 开始。正如指南所述,您可以在https://play.google.com/store/apps/details?id=下载 Scandit Demo 应用程序com.scandit.demoapp找出每个代码的长度(只需进入“任何代码”模式并扫描条形码)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM