【问题标题】:Disable scanner programmatically in DataWedge在 DataWedge 中以编程方式禁用扫描仪
【发布时间】:2020-02-21 14:31:44
【问题描述】:

实际上我使用DataWedge 中的Output Intent 将解码后的数据发送到我的应用程序,因此在应用程序中记录了一个BroadcastReceiver 来获取解码后的数据

private BroadcastReceiver myBroadcastReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();

        if (Objects.equals(action, getResources().getString(R.string.activity_intent_filter_action))) {
            //  Received a barcode scan
            try {
                displayScanResult(intent);
            } catch (Exception e) {
                //  Catch if the UI does not exist when we receive the broadcast
            }
        }
    }
};

问题是是否可以在不使用 EMDK 的情况下以某种方式禁用扫描仪? 如果满足以下条件,我将能够禁用扫描:

 if(Alerts.dialogError != null && Alerts.dialogError.isShowing()){
            // Here i should block the scanner
        }

【问题讨论】:

    标签: android datawedge


    【解决方案1】:

    是的,有两种方法,其中最简单的是:

    Intent dwIntent = new Intent();
    dwIntent.setAction("com.symbol.datawedge.api.ACTION");
    //  Enable
    dwIntent.putExtra("com.symbol.datawedge.api.SCANNER_INPUT_PLUGIN", "ENABLE_PLUGIN");
    //  or Disable
    dwIntent.putExtra("com.symbol.datawedge.api.SCANNER_INPUT_PLUGIN", "DISABLE_PLUGIN");
    sendBroadcast(dwIntent);
    

    有关更多上下文,我刚刚在https://developer.zebra.com/blog/quickly-suspend-scanning-your-app-datawedge 写了一篇关于此的开发人员文章

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多