【问题标题】:EMDK scanner puts scanned value into input textEMDK 扫描仪将扫描的值放入输入文本中
【发布时间】:2016-07-13 14:01:37
【问题描述】:

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

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

请帮忙

【问题讨论】:

    标签: android barcode-scanner motorola-emdk


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

      DataWedge 包含一个配置文件系统,您可以在其中将应用程序包名称和活动与特定配置文件相关联,并通过 Intent 将数据发送到您的应用程序。您可以在 Zebra developer portal 尤其是 how to configure DataWedge 上找到更多相关信息。

      除此之外,Zebra Technologies 会定期发布适用于 Java 和 Xamarin 的 EMDK,以支持从 Android 应用程序自动执行这些配置,并提供 a full Barcode Scanning API that allows your application to take full control of the hardware barcode scanner

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

      【讨论】:

      • 哪个函数? Datawedge 可以在系统范围内或按应用程序或按活动禁用。您可以在所使用设备的集成商指南中找到更多信息(可在 zebra 支持网站上找到)
      • 对于默认情况(焦点 EidtText 接收条形码数据),您说数据将作为键盘事件传递。那么我可以在 InputConnection#commitText 方法中看到数据吗?谢谢!
      • Zebra 的 DataWedge 默认不再注入键盘事件。我看到某些版本具有可以发送关键事件的配置。但您可能会在 Zebra 的开发者门户网站上获得更多帮助:developer.zebra.com
      【解决方案3】:

      根据@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 here

      【讨论】:

        猜你喜欢
        • 2011-02-23
        • 2017-09-04
        • 1970-01-01
        • 2016-06-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-06-20
        • 1970-01-01
        相关资源
        最近更新 更多