Push Notification in android are used to pass a message when app is not in active state also.Generally push notification are used in chatting based apps to show a new message, and also it has usages in other different apps like news, eCommerce, shopping apps, games and many more…


In this tutorial i will show you a how a push notification works in a local style i.e., data will be created and passed within same activity itself.




The push notification i show here contains


Creating Project in Android Studio

creating proj


File -> New..->New Project

you will see the above screen


Fill in the project details, and choose the layout depending upon your requirement if you are beginners and don’t know what to choose choose blank activity.


In layout file i have added the required number of  edittext, and buttons to create push notifications, you may change your design accordingly.

2. Creating Layout file activity_main.xml




In this MainActivity.java we have Declared our Push Notification


Notification.Builder builder = new Notification.Builder(MainActivity.this);

And made a notification screnn such that user entered text will get displayed as a Push Notification.

3.Creating MainActivity.java File



No Additional Permissions required as this is local data based Push Notification but when you are doing with server based push notifications you will require Internet Permission.


4. AndroidManifest .xml



pushnotification5   pushnotification4    pushnotification3

Show Buttons
Hide Buttons
Read previous post:
Android SQLite Tutorial On Inserting, Deleting Values into Database