Main difference between Manifest and Programmatic registering of BroadcastReceiver

前端 未结 3 2028
一生所求
一生所求 2020-12-05 14:03

I am trying to understand the main differences between registering a BroadcastReceiver in the Manifest and registering it programmatically...

My understanding is bas

3条回答
  •  温柔的废话
    2020-12-05 14:36

    Your understanding is correct according to mine.

    Another relevant (and obscure) difference is that some specific system Intents will only trigger your receiver if it's programmatically registered. Receivers only defined in the manifest won't be called. Examples are: ACTION_SCREEN_ON, ACTION_SCREEN_OFF, ACTION_BATTERY_CHANGED, ACTION_HEADSET_PLUG

    I'd recommend this text that mentions various details about Intents and Receivers.

提交回复
热议问题