Back to Browse

Notification in Android

15 views
Apr 8, 2021
24:54

Android Notification provides short, timely information about the action happened in the application, even it is not running. The notification displays the icon, title and some amount of the content text. 1. First step create object of Notification.Builder class or NotificationCompat.Builder class. 2. Second step set below properties of any one class 3. Third step in optional here attach the action with notification for that use the Intent and PendingIntent class objects. 4. Fourth step create reference of NotificationManager class and use the notify method, issue the notification. Set Android Notification Properties The properties of Android notification are set using Notification.Builder object. Some of the notification properties are mention below: setSmallIcon(): It sets the icon of notification. setContentTitle(): It is used to set the title of notification. setContentText(): It is used to set the text message. setAutoCancel(): It sets the cancelable property of notification.

Download

0 formats

No download links available.

Notification in Android | NatokHD