Leadev
Leadev

Reputation: 55

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

I would like to access a Broadcast Receiver declared in the manifest to be able to register it for some intent which requires explicit registration (using registerReceiver()) like Intent.ACTION_PACKAGE_ADDED. How can I do that?

TIA

Upvotes: 1

Views: 229

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006869

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

A manifest-registered receiver is only created when a matching broadcast is sent, and it lives long enough for a single onReceive() call. So, there is "the instance created by the App from the manifest" that you can obtain at other times. You need to create your own instance to use with registerReceiver().

Upvotes: 1

Related Questions