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.
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.
There are certain important terms for Notification that we’re discussing below-
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