如何访问清单中声明的​​组件实例(广播接收器)

how to acess an instance of a component (A broadcastreceiver) declared in the manifest

我想访问清单中声明的​​广播接收器,以便能够为某些需要显式注册(使用 registerReceiver())的意图注册它,例如 Intent.ACTION_PACKAGE_ADDED。我该怎么做?

TIA

what I would like is to register the instance created by the App from the manifest

只有在发送匹配的广播时才会创建清单注册的接收器,并且它的寿命足以进行一次 onReceive() 调用。所以,有"the instance created by the App from the manifest"可以在其他时间获得。您需要创建自己的实例以与 registerReceiver().

一起使用