Reputation: 1023
I'm adapting an app to API 30 and I've found this problem.
In previous versions it works nicely with an structure like this:
On my main activity I get to declare something like this:
final LocalBroadcastManager mLocalBroadcastManager3;
BroadcastReceiver mBroadcastReceiver3 = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
[code]
}
};
mLocalBroadcastManager3 = LocalBroadcastManager.getInstance(this);
IntentFilter mIntentFilter3 = new IntentFilter();
mIntentFilter3.addAction("com.durga.action.exit2");
mLocalBroadcastManager3.registerReceiver(mBroadcastReceiver3, mIntentFilter3);
And I call it this way from a JobIntentService:
localBroadcastManager.sendBroadcast(new Intent(
"com.durga.action.exit2"));
In API 30 this last instruction is executed but it's as if it never happened, it doesn't raise any exception, but the onReceive function declared in MainActivity is never executed.
What could I do to solve this?
Upvotes: 0
Views: 347