In this DataFlair Android Tutorial, we’ll learn about Android Push Notification. Before moving forward with Push Notification, we shall briefly discuss what notification is. So, notification is a simple message that pops up on a device. Either applications can generate Notification or they can be sent from the server to the user. The Notifications can be pushed even when an application is not running. These notifications find use for messages, updates, downloads, etc.

Learn more about Notifications and their types.

Android push notification

Android Push Notification

Push notifications are the first and most important communication channels used in applications today. These days, almost every app that we use makes use of push notifications. Push notification is an evolved technology that has come from the message delivery system.

These days, we have so many apps on our phone that we do not even remember them all. And here, push notification comes into the role; they deliver relevant information to users on time.

Push notifications use two APIs: the Notification API and the second one is Push API. Thisnotification API here lets the app display the notification. The Push API lets the server work, and handle the Push messages even when the app is not in use.

Push Notification Terminologies

There are certain important terms for Notification that we’re discussing below-

  • Notification– This is the message which gets displayed to the users outside the apps.
  • Push Message- This is the message sent from the server to the users.
  • Push Notification– This notification is for Push Message.
  • Notification API– This is the interface to configure and display notifications to the users.
  • Push API– The interface helps us subscribe to the push service and receive push messages.
  • Push Service– This is a system to route the message from the server to clients.

To display a notification we first need to instantiate a NotificationManager, to do this we write the following-

NotificationManager notification_name;
Notification_name = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);

After that, we would need to create an instance of Notification class and specify its attributes as follows:

Notification noti_fication= new Notification( android. R. drawable.note, title, System.currentTimeMillis());)

#android tutorials #android push notification #push notification in android #android

Android Push Notification Overview - DataFlair
2.70 GEEK