Comparison of two ways of Android registration broadcasting
Comparison of two ways of Android registration broadcasting
1. Resident broadcast
Resident broadcast, when your application is closed, if there is a broadcast message, the broadcast receiver you write can also receive it,
His registration method is to register in androidmanifest.xml in your application. Generally speaking, this method is static registration
The following is a configuration example
2. Non resident broadcasting
When the application ends, the broadcast will naturally disappear. For example, you can register the broadcast receiver in oncreate or onresume in the activity
Uninstall the broadcast receiver in ondestory. In this way, your broadcast receiver will be a non-stationary one. This is also called dynamic registration.
For example, write a broadcast receiver that monitors the status of sdcard
Thank you for reading, hope to help you, thank you for your support to this site!