3

我有使用 EMDK 的应用程序,我的测试设备是 TC55。我成功创建了启用和接收扫描数据的代码。但我有不同的问题 - 当我扫描条形码并在我的片段扫描值中看到 EditText 字段时,总是在那里添加。即使输入字段没有焦点。

我不希望这种行为 - 我希望扫描结果仅传递给应用程序的后端方法,而不是输入文本字段。

请帮忙

4

3 回答 3

2

在与 Xamarin EMDK 合作数月后,我终于设法删除了此类功能。只需进入您的个人资料以添加击键功能并禁用所有击键功能。

于 2017-01-17T14:51:36.073 回答
1

以下@GustavoBaiocchiCosta是答案,这里是如何通过意图禁用击键:

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);
}

这可以防止使用条形码内容填充焦点输入字段。

在这里查看API

于 2021-01-08T06:03:12.827 回答
1

默认情况下,Zebra Technologies android 设备(如TC55)配置为使用 DataWedge 插入条形码数据作为键盘输入事件。
这样,无需特定编码,您的应用程序就可以接收条形码数据。

DataWedge 包含一个配置文件系统,您可以在其中将应用程序包名称和活动与特定配置文件相关联,并通过 Intents 将数据发送到您的应用程序。您可以在Zebra 开发人员门户上找到有关此内容的更多信息,尤其是有关如何配置 DataWedge 的信息

除此之外,Zebra Technologies 会定期发布适用于 Java 和 Xamarin 的 EMDK,以便从 Android 应用程序自动执行这些配置,并提供完整的条码扫描 API,让您的应用程序能够完全控制硬件条码扫描器

免责声明:我为 Zebra Technologies 工作。

于 2016-07-17T11:14:02.587 回答