Is there a way to prevent a keyboard Enter event after a successful scan?

Good day

I’m developing an Android app for the Skorpio X5. When a successful scan is registered, it finishes off with a keyboard Enter event, as if the user pressed enter on the keyboard. Is there a way to prevent this from happening? The issue is that when the user performs a scan, it then places the focus on a view, for example a button. The user then scans again and causes the button to be clicked.

Hope this makes sense.

Thanks.

Hello @Louis_Weideman

I think that that behavior is due to the default scanner settings, which adds an “LF” a the the end of each barcode.
If you go under “Setting → Datalogic Setting → Scanner Settings → Formatting → Standard Formatting”, you will find the setting “Label Suffix”.
This is the setting that adds the ‘LF’ that creates the Enter event after each reading.

Hey Louis,
I believe what is causing your issue is the formatting of the barcode.
Here are some steps you can follow to change this behavior:

  • Open the app that is labelled Datalogic Settings.
  • Open the Scanner and Decoder tab.
  • Open the Formatting section.
  • Then Standard Formatting.
  • You should see a Label Suffix.
  • By default this is set to [LF] which is the ascii control character for Line Feed.
  • Line Feed appears as a enter button press to the user.
  • If you would like to disable this, just remove it from Label Suffix and leave it blank.

You can use our SDK to adjust this value as well:
https://datalogic.github.io/android/overview
https://datalogic.github.io/android-sdk-docs/reference/com/datalogic/decode/configuration/Formatting.html

Here is some information on the other control characters if you would like to use them:
https://en.wikipedia.org/wiki/Control_character

Drew Hugentobler
L3 - Mobile Computer Specialist Support Engineer

1 Like

I removed [LF] from the label suffix and that fixed my issued. Thanks a bunch!

1 Like

Hi

I tried to change this setting through the SDK. I’m using the example from here:

However, ScannerProperties.edit returns a NULL object. I can’t see that I’m missing anything from that example.

Here is my code for reference:

BarcodeManager bm = new BarcodeManager();
ScannerProperties config = ScannerProperties.edit(bm);
config.format.labelPrefix.set("");

Hello @Louis_Weideman,
I stripped down our DecodeConfigSampleAPI example to just what you would need, see if any of this is missing from your code.
In your code, double check, it looks like you are adjusting the prefix and not the suffix.

    // Constant for log messages.
    private final String LOGTAG = getClass().getName();

    BarcodeManager manager = null;
    ScannerProperties configuration = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Create a BarcodeManager.
        manager = new BarcodeManager();

        // Pass it to ScannerProperties class.
        // ScannerProperties cannot be instantiated directly, instead call edit.
        configuration = ScannerProperties.edit(manager);

        // Now we can change some Scanner/Device configuration parameters.
        // These values are not applied, as long as store method is not called.
        configuration.format.labelSuffix.set("");

        // From here on, we would like to get a return value instead of an exception in case of error.
        Integer e = ErrorManager.enableExceptions(false);

        // Now we are ready to store them.
        // Second parameter set to true saves configuration in a permanent way.
        // After boot settings will be still valid.
        int errorCode = configuration.store(manager, true);

        // Check return value.
        if(errorCode != ConfigException.SUCCESS) {
            Log.e(LOGTAG, "Error during store", ErrorManager.getLastError());
        }
    }

Also, a lot of our customers use third party applications. Without developers having access to our SDK, those customers end up using Scan2Deploy to create and apply a configuration to all of their devices.

2 Likes