How Does a Broadcast Receiver Work in Android?
Contents Broadcast Receiver Is an Android Component Which Allows You to Send or Receive Android System or Application Events. All the Registered Application...
Broadcast receiver is an Android component which allows you to send or receive Android system or application events. All the registered application are notified by the Android runtime once event happens. It works similar to the publish-subscribe design pattern and used for asynchronous inter-process communication.
What is the use of broadcast receiver in android?
A broadcast receiver (receiver) is an Android component which allows you to register for system or application events. All registered receivers for an event are notified by the Android runtime once this event happens.
How do you trigger a broadcast receiver?
Here is a more type-safe solution:
- AndroidManifest.xml : <receiver android_name=”.CustomBroadcastReceiver” />
- CustomBroadcastReceiver.java public class CustomBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // do work } }
8 авг. 2018 г.