Lukas Novicky
Lukas Novicky

Reputation: 952

EMDK scanner puts scanned value into input text

I have application using EMDK, my test device is TC55. I successfully created code for enabling and receiving scanning data. But I have different problem - when I scan barcode and have EditText field visible in my fragment scanned value ALWAYS is added there. Even when input field has no focus.

I don't want that behavior - I want result of scanning to be passed only to backend methods of application, and not to input textfield.

Please, help

Upvotes: 6

Views: 3412

Answers (3)

Gustavo Baiocchi Costa
Gustavo Baiocchi Costa

Reputation: 1448

After months of working with Xamarin EMDK, I finally managed to remove such a feature. Just go into your profile to add a keystroke functionality and disable all keystroke features.

Upvotes: 3

Pierre
Pierre

Reputation: 9052

Following @GustavoBaiocchiCosta's answer, here is how to disable keystrokes via intent:

public void setKeystrokeConfig(boolean enabled) {
    // Keystroke plugin properties bundle
    Bundle bParams = new Bundle();
    bParams.putString("keystroke_output_enabled", enabled ? "true" : "false"); // <-- 
    bParams.putString("keystroke_action_char", "9");
    bParams.putString("keystroke_delay_extended_ascii", "500");
    bParams.putString("keystroke_delay_control_chars", "800");
    
    // Keystroke plugin bundle
    Bundle bConfig = new Bundle();
    bConfig.putString("PLUGIN_NAME", "KEYSTROKE");
    bConfig.putBundle("PARAM_LIST", bParams);
    
    // Main bundle properties
    Bundle configBundle = new Bundle();
    configBundle.putString("PROFILE_NAME", "Profile12");
    configBundle.putString("PROFILE_ENABLED", "true");
    configBundle.putString("CONFIG_MODE", "CREATE_IF_NOT_EXIST");
    configBundle.putBundle("PLUGIN_CONFIG", bConfig);
    
    // Send intent to DataWedge
    Intent i = new Intent();
    i.setAction("com.symbol.datawedge.api.ACTION");
    i.putExtra("com.symbol.datawedge.api.SET_CONFIG", configBundle);
    i.putExtra("SEND_RESULT", "true");
    i.putExtra("COMMAND_IDENTIFIER", "KEYSTROKE_API");
    this.sendBroadcast(i);
}

This prevents a focused input field being populated with the barcode content.

Check out the API here

Upvotes: 2

pfmaggi
pfmaggi

Reputation: 6476

By default Zebra Technologies android devices, like TC55, are configured to use DataWedge to insert barcode data as keyboard entry event.
In this way, with no particular coding, your application can receive barcode data.

DataWedge includes a profile system, where you can associate your application package name and Activities to specific profiles and have the data sent to your application via Intents. You can find more about this on Zebra developer portal and in particular on how to configure DataWedge.

On top of that Zebra Technologies periodically releases EMDKs for Java and Xamarin to enable automating these configurations from Android applications and provides a full Barcode Scanning API that allows your application to take full control of the hardware barcode scanner.

Disclaimer: I work for Zebra Technologies.

Upvotes: 4

Related Questions