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.
if the intent is inside your app only, consider using LocalBroadcastManager
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With