kolistivra
kolistivra

Reputation: 4429

Semi-explicit intents

There are two kinds of intents in Android:

Is it possible to have another level, in the sense that I just specify package name, but no explicit class name so that all broadcast receivers in a package that respond to an action get activated? How can this effect be achieved?

Upvotes: 0

Views: 42

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007554

Is it possible to have another level, in the sense that I just specify package name, but no explicit class name so that all broadcast receivers in a package that respond to an action get activated

If by "just specify package name" you really mean "just specify package name and action string", you should be able to get your desired effect if you use setPackage() for specifying the package name.

That being said, I have not tried this for multiple receivers within a single package all listening for the same action string, though the documentation suggests that it should work. Personally, I'd handle that by having just one receiver and use an internal event bus for routing beyond there, or use the event bus exclusively if this broadcast is from the app to the same app.

Upvotes: 1

Related Questions