Android 如果容纳接收器的进程被终止,BroadcastReceivers 是否仍会收到 intents?

Will Android BroadcastReceivers still receive intents if the process housing the receiver is killed?

我很好奇发送到另一个进程的未决意图指定的广播接收器是否会触发,即使应用程序已被终止。

是的。如果应用程序通过其 AndroidManifest.xml 中的 <receiver> 标签发布 BroadcastReceiver,并且某些东西终止了应用程序的进程,则传入的意图将(重新)启动该进程。

另一方面,如果应用程序在其 Activity.onResume() 方法中注册了接收器,则应在 Activity.onPause().

中注销它

Receiver Lifecycle and Process Lifecycle