Notifications:
To work with notification, we have following steps
1) Create Notification Builder object
2) Set notification properties like icon, title, text
3) Create the Intent object with required activity to open on clicking that notification
4) Attach that Intent to a PendingIntent object which is responsible for processing Intent with some delay.
5) Get the NotificationManager system service object
6) Build the notification
7) Notify the notification using NotificationManager.
Ex:
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);
mBuilder.setSmallIcon(R.mipmap.ic_launcher);
mBuilder.setContentTitle(“My notification”);
mBuilder.setContentText(“Hello World!”);
Intent resultIntent = new Intent(this, MainActivity.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addParentStack(MainActivity.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(123, mBuilder.build());
Refer
https://developer.android.com/guide/topics/ui/notifiers/notifications.html
Create an Android application to show a notification on clicking the button