几秒钟后 Android 单挑通知消失 [英] Android Heads-up notification disappears after a few seconds
本文介绍了几秒钟后 Android 单挑通知消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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.
这篇关于几秒钟后 Android 单挑通知消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文