Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How does the state of a broadcastreceiver affect a process?


Asked by Alexis Strong on Nov 30, 2021 FAQ



The state of your BroadcastReceiver (whether it is running or not) affects the state of its containing process, which can in turn affect its likelihood of being killed by the system. For example, when a process executes a receiver (that is, currently running the code in its onReceive () method), it is considered to be a foreground process.
Next,
Broadcast receivers enable applications to receive intents that are broadcast by the system or by other applications, even when other components of the application are not running. There are two ways to make a broadcast receiver known to the system: One is declare it in the manifest file with this element.
Also Know, If " false ", the only messages the broadcast receiver can receive are those sent by the system, components of the same application, or applications with the same user ID. If unspecified, the default value depends on whether the broadcast receiver contains intent filters.
Besides,
When you use registerReceiver (BroadcastReceiver, IntentFilter) , any application may send broadcasts to that registered receiver. You can control who can send broadcasts to it through permissions described below.
Likewise,
A process that is currently executing a BroadcastReceiver (that is, currently running the code in its onReceive (Context, Intent) method) is considered to be a foreground process and will be kept running by the system except under cases of extreme memory pressure.