A BroadcastReceiver is a dormant component of Android that listens to system-wide broadcast events or intents. When any of these events occur it brings the application into action by either creating a status bar notification or performing a task. Unlike activities, a BroadcastReceiver doesn’t contain any user interface. It’s generally implemented to delegate the tasks to services depending on the type of intent data that’s received. Following are some of the important system wide generated intents.
- android.intent.action.BATTERY_LOW : Indicates low battery condition on the device.
- android.intent.action.BOOT_COMPLETED : This is broadcast once, after the system has finished booting
- android.intent.action.CALL : To perform a call to someone specified by the data
- android.intent.action.DATE_CHANGED : The date has changed
- android.intent.action.REBOOT : Have the device reboot
- android.net.conn.CONNECTIVITY_CHANGE : The mobile network or wifi connection is changed(or reset)
To set up a Broadcast Receiver in our android application we need to do the following two things.
- Creating a BroadcastReceiver
- Registering a BroadcastReceiver
I giving you two android project download and run and get your result. Thanks.
if you have any problem please comment below.