Is it possible to set the duration of the headsup notification to unlimited? right now its displayed just for 5 seconds. Already tried different things like changing the category. But the duration always is 5 seconds.
Here is my code:
Notification notification =
notificationBuilder
.setCategory(Notification.CATEGORY_CALL)
.setContentText("TKSE Werk Duisburg")
.setSmallIcon(R.drawable.ic_tk_individual_signet_logo)
.setOngoing(true)
.setAutoCancel(false)
.setVisibility(Notification.VISIBILITY_PUBLIC)
.setContentIntent(contentIntent)
.setCustomHeadsUpContentView(viewNotificationHeadsUp) .setCustomContentView(viewNotificationSmall)
.setPriority(Notification.PRIORITY_MAX)
.setVibrate(new long[20]).build();
Tried the same things like on this thread: Controlling Android Notification Duration for HeadsUp but it did not help me.
Interesting fact: On my Developer Phone a Samsung S5 mini -> its displayed with no time limit On another Developer Phone a Samsung S7 -> its displayed 5 seconds
This should work. I have added extra
onGoing(true)
&category call
for notification category.PS. import android.app.Notification; for setting notification category (call)
Try that solution (the one that you have posted as the link..) but after doing that change dont forget to change the
NOTIFICATION_ID
sometimes if the notification id is not changed some of the previous attributes of the notifications stays .. soChange the notification id when you change any attribute of notification builder