Explore Courses

Watch Android Video Tutorial For Beginners


Android Video Tutorial

Broadcast receiver and notification

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…

Broadcast receiver

Broadcast receiver

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.

Kind of a job to pass notification

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
String uniqueActionString=”com.androidbook.intents.testbc”;
Intent broadcast intent=new intent(unique action string);
Broadcastintent.putextra(“message”,”Hello world”);
Activity.send broadcast(broadcastintent);

Listen to broadcast message

Public class receiver extends broadcastreceiver
Private static final string tag=”Receiver”;
public void on receive(Context context,Intent intent)
Log.d(“Test Receiver”,”intent=”+intent);
String message=intent.getStringExtra(“message”);
Log.d (tag,message);

Registering a receiver in the manifest file



android:name =”com.androidbook.intents.testbc”/>




Kind of a messagethat can be display in notification area of your phone.
To see of the notifications,the user opens the notification drawer.

Creating Notifications



nbuilder.setContentTitle(“new msg”);
nbuild.setContextText(“hello everyone”);

Context Menu

Show notificationto the user using NotificationManager

NotificationManager nm=(NotificationManager)

Call Us

Training in Cities: Bangalore, Hyderabad, Chennai, Delhi, Kolkata, UK, London, Chicago, San Francisco, Dallas, Washington, New York, Orlando, Boston

Select Currency