Send a broadcast only to specific Activity

Viewed 8723

I have one Activity which creates a BroadcastReceiver with an IntentFilter in the method onCreate(...):

IntentFilter iFilter = new IntentFilter("action");

receiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {

    }
};

registerReceiver(receiver, iFilter);

On the other side is an IntentService, which shall send some data:

Intent intent = new Intent(getApplicationContext(), receiver.class);
intent.setAction("action");

[...]

sendBroadcast(intent);

But it seems not to work. No Broadcast ist received.
My service class is in an android lib, perhaps this makes trouble.

Thanks for any advices.

2 Answers
Related