How to Create Notification in Android using Android Studio?

2 561

Notification in Android

Before directly implementing the notification code in your android studio, let’s understand little about notification:

A notification is a message you can display to the user outside of your application’s normal UI. When you tell the system to issue a notification, it first appears as an icon in the notification area.
To see the details of the notification, the user opens the notification drawer. Both the notification area and the notification drawer are system-controlled areas that the user can view at any time.

Example of notification:

Notification in Android

 

Overall process

  • We specify the UI information and actions for a notification in a NotificationCompat.Builder object.
  • To create the notification itself, we call NotificationCompat.Builder.build(), which returns a Notification object containing our specifications.
  • To issue the notification, we pass the Notification object to the system by calling NotificationManager.notify().

Now let separate it in four steps:

 

Video: