Sending non-protected broadcast using Intent Wedge

Hello @matt_daniel

I think the app isn’t receiving the barcode data because of a mismatch between how Decode Wedge sends the intent and how the code receives it.

in your code you use:

  • An [IntentFilter] attribute on the Activity
  • OnNewIntent() method to handle intents

This approach works ONLY if Decode Wedge is configured to use START_ACTIVITY mode.

However, in your case Memor 30’s Decode Wedge is configured to send BROADCAST intents (as you can see from the log message “Sending non-protected broadcast…”).

The difference is that while with START_ACTIVITY the Intent is delivered directly to an Activity (explicit intent) → triggers OnNewIntent(), with BROADCAST, the Intent is sent as a broadcast (implicit intent) and requires a BroadcastReceiver to intercept it.

As a result the IntentFilter attribute and OnNewIntent() method are never triggered by implicit broadcast intents.

The solution I would suggest is to create and register a BroadcastReceiver dynamically in code.

Code sample:

protected override void OnCreate(Bundle savedInstanceState)
{
      ...
      // BroadcastReceiver registration
      var filter = new IntentFilter("com.datalogic.decodewedge.decode_action");
      filter.AddCategory("com.datalogic.decodewedge.decode_category");
      RegisterReceiver(new DecodeReceiver(), filter);
}

// Receiver
public class DecodeReceiver : BroadcastReceiver
{
    public override void OnReceive(Context ctx, Intent i)
    {
        var data = i.GetStringExtra("com.datalogic.decode.intentwedge.barcode_string");
        var type = i.GetStringExtra("com.datalogic.decode.intentwedge.barcode_type");
    }
}

Simone Callegari
SW Engineer - Mobile Computers L3 Support | Datalogic