Main difference between Manifest and Programmatic registering of BroadcastReceiver

前端 未结 3 2023
一生所求
一生所求 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:42

    You have it basically correct.

    Note that a manifest-registered receiver object is only used once. A new instance of your BroadcastReceiver is created for each broadcast. The primary use of manifest-registered receivers is for broadcasts that may go on while your code is not in memory (e.g., BOOT_COMPLETED, your scheduled alarms via AlarmManager).

提交回复
热议问题