Can a LocalBroadcastManager send an Intent to a globally registered BroadcastReceiver if it resides in the same App? Or do I have to use context.sendBroadcast() for that?
No. LocalBroadcastManager
cannot send Intent to global BroadcastReceivers
.
Explanation:
LocalBroadcastManager
has a private HashMap, in which it maps BroadcastReceiver
to ArrayList<IntentFilter>
, when registerReceiver method is called explicitly using any context within application. It does not hold any record of global BroadcastReceivers
declared in AndroidManifest.xml
. So, LocalBroadcastManager
won't send Intent to global BroadcastReceivers
.
See the below screenshot captured while I debugged LocalBroadcastReceiver
from my application which has three BroadcastReceivers
declared globally in AndroidManifest.xml