notifications

print
notes

Notifications
//what to do at tap
Intent intent = new Intent(getApplicationContext(), MainActivity.class);

PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 1, intent, 0);

Notification notification = new Notification.Builder(getApplicationContext())
.setContentTitle("Lunch is ready!")
.setContentText("It's getting cold...")
.setContentIntent(pendingIntent)
.addAction(android.R.drawable.sym_action_chat, "Chat", pendingIntent)
.setSmallIcon(android.R.drawable.sym_def_app_icon)
.build();

NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

notificationManager.notify(1, notification);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.