Watch Android Video Tutorial For Beginners
Broadcast receiver and notification
Android training course is designed to impart thorough knowledge on Android and its features. It includes Android Architecture, Android Components, Application Lifecycle process, Android Resources, Layout Manager and Styles, Intents, Menus, Service Lifecycle, Broadcaster receiver and Notification, Preference Management, SQLite Database, Google Maps, Location Tracking, Google Play Registration.
In this tutorial, you will learn how to implement a Broadcast Receiver in your Android application. Broadcast Receiver is completely asynchronous, and is considered to be a foreground process and will be kept running with the Android system. So lets begin…
It is an android application component, which can respond to broadcast message from any another application or system itself. For example:
- battery low
- SMS receiving
- Wifi activated / deactivated message etc.
Kind of a job to pass notification, when specified event occur.
Registration of Broadcast Receiver
Static: Use <receiver> tag in your manifest file.
Dynamic: Use context.registerreceiver()method in code.
Broadcasting the message using send broadcast() method:
//Create an intent with an action
Intent broadcast intent=new intent(unique action string);
Listen to broadcast message
Public class receiver extends broadcastreceiver
Private static final string tag=”Receiver”;
public void on receive(Context context,Intent intent)
Registering a receiver in the manifest file
Kind of a messagethat can be display in notification area of your phone.
To see of the notifications,the user opens the notification drawer.
Show notificationto the user using NotificationManager