1

Actually i use Output Intent from DataWedge to send decoded data to my application, so in the application there is recorded a BroadcastReceiver which get the decoded data

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

The question is is it possible in some way disable the scanner without using EMDK? I would be able to disable the scanne if the following condition is true:

 if(Alerts.dialogError != null && Alerts.dialogError.isShowing()){
            // Here i should block the scanner
        }
Delphi Coder
  • 1,723
  • 1
  • 14
  • 25
NiceToMytyuk
  • 3,644
  • 3
  • 39
  • 100

2 Answers2

5

Yes, there are two ways, the easiest of which being:

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

For more context, I just wrote a developer article about this at https://developer.zebra.com/blog/quickly-suspend-scanning-your-app-datawedge

Darryn Campbell
  • 1,441
  • 10
  • 13
0

The general API documentation is available at: https://techdocs.zebra.com/datawedge/latest/guide/api/

The documentation for the scanner input plugin is here: https://techdocs.zebra.com/datawedge/latest/guide/api/scannerinputplugin/

As of DataWedge 13.0 the following code is used to enable/disable the scanner input plugin:

private void enableScanner() {
    Intent i = new Intent();
    i.setAction("com.symbol.datawedge.api.ACTION");
    i.putExtra("com.symbol.datawedge.api.SCANNER_INPUT_PLUGIN", "ENABLE_PLUGIN");
    i.putExtra("SEND_RESULT", "true");
    i.putExtra("COMMAND_IDENTIFIER", "MY_ENABLE_SCANNER");  //Unique identifier
    this.sendBroadcast(i);
}

private void disableScanner() {
    Intent i = new Intent();
    i.setAction("com.symbol.datawedge.api.ACTION");
    i.putExtra("com.symbol.datawedge.api.SCANNER_INPUT_PLUGIN", "DISABLE_PLUGIN");
    i.putExtra("SEND_RESULT", "true");
    i.putExtra("COMMAND_IDENTIFIER", "MY_DISABLE_SCANNER");  //Unique identifier
    this.sendBroadcast(i);
}
ag00se
  • 116
  • 1
  • 10