CREATE NOTIFICATION WITH ACTION:
Notification.Builder mBuilder = new Notification.Builder(MainActivity .this);
mBuilder.setSmallIcon(R.drawable.imageiconxyz );
mBuilder.setContentTitle("title ");
mBuilder.setContentText("text ");
mBuilder.setDefaults( Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
NotificationManager notificationManager = (NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
Intent notificationIntent = new Intent(getApplicationContext(),
MainActivity.class );
PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0,
notificationIntent, Intent.FLAG_ACTIVITY_NEW_TASK);
mBuilder.setContentIntent(pendingIntent).setAutoCancel(true);
notificationManager.notify(1, mBuilder.build());
0 Comments: