I would that the notification does not disappear after a few seconds. So i have create the notification like this:
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
builder.setSmallIcon(R.drawable.cast_ic_notification_small_icon)
.setDefaults(Notification.FLAG_ONGOING_EVENT)
.setPriority(Notification.PRIORITY_HIGH)
.setContentTitle(notificationDetails.getSubject())
.setContentText(notificationDetails.getMessage())
.setColor(context.getResources().getColor(R.color.colorPrimary))
.setOngoing(true);
and setting the FLAG_ONGOING_EVENT and the method setOngoing(true).
but after a few seconds the notification continues to disappears. I wish the notification to disappear only when the user clicks on. Thank you.
Duration of heads-up notification can't be changed It is set at OS level Depends on OS how much time it provides for it.