Simple question - Can I register a single BroadcastReceiver
to multiple Intent actions? Here\'s what I\'m considering:
Yes, one BroadcastReceiver can receive intents with several actions. And your example is valid. You may have multiple "actions" in one filter. Moreover, in this case it is more appropriate than what seems a safer way: creating several filters with a single action (as proposed in the answer by @advantej). Having several actions in a filter clearly communicates that you are expecting one of several actions (logical "or").
These words from "Intent and Intent filters" explain choice between one vs. many intent filters for more complex cases:
It's okay to create a filter that includes more than one instance of
, , or . If you do, you simply need to be certain that the component can handle any and all combinations of those filter elements. When you want to handle multiple kinds of intents, but only in specific combinations of action, data, and category type, then you need to create multiple intent filters.
Please see different examples of Intent filters here: AndroidManifest.xml