Notification is ship to the users to laissez passer on approximately data close application, updates, offering in addition to and then on. Email application notify you lot if at that spot is whatever novel postal service received in addition to intelligence app demo notifications to the user if at that spot is whatever viral intelligence inwards the network.
Android Example: How to Show in addition to Clear Notification inwards Android App
Let’s practise a novel android application alongside the projection name: Android Notification Example, domain name: viralandroid.com, select API eleven every minute minimum API marker in addition to blank activity.
XML Layout File
Open your XML layout file in addition to add together 2 buttons 1 to demo notification in addition to approximately other to clear your notification alongside dissimilar id within whatever layout. Following is the consummate content of XML layout file.
Java Activity File
Open your coffee action file in addition to declare the variables for Button, NotificationManager, Notification in addition to PendingIntent. Override onClick listener for both push clit to demo in addition to clear notification inwards android. Following is the consummate coffee code of action file.
Now, run your Show in addition to Clear Android Notification Example application in addition to click on Show Notification Button, you lot volition run across notification icon inwards notification bar. If you lot opened upward notification drawer you lot volition run across a notification alongside icon, brusque description in addition to sub championship that nosotros accept created above. To clear this notification you lot remove to click on the Clear Notification button. Above, at that spot is a screenshot of this android notification event project.