3

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

Lukas Novicky
  • 921
  • 1
  • 19
  • 44

3 Answers3

2

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

Gustavo Baiocchi Costa
  • 1,379
  • 3
  • 16
  • 34
1

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.

pfmaggi
  • 6,116
  • 22
  • 43
  • Which function? Datawedge can be disabled systemwide or per application or per activity. You can find more info on the integrators guide of the device you are using (available on zebra support website) – pfmaggi Jan 18 '17 at 05:24
  • For the default case (focused EidtText receive barcode data), you said the data would be passed as keyboard event. So can I see the data in InputConnection#commitText method? Thank you! – Liu Tao Jul 19 '19 at 09:43
  • Zebra's DataWedge doesn't inject keyboard events by default anymore. I saw that some versions had configurations you can do to have the key events sent. But you may get more help on Zebra's developer portal: developer.zebra.com – pfmaggi Jul 19 '19 at 10:05
1

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

Pierre
  • 8,397
  • 4
  • 64
  • 80