抬头通知有时不起作用 [英] Heads up notification do not work sometimes

查看:79
本文介绍了抬头通知有时不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以这种方式发出抬头通知:

I make a head up notification this way:

Notification.Builder nb = new Notification.Builder(context)
        .setSmallIcon(icon)
        .setContentTitle("Title")
        .setContentText("Content")
        .setDeleteIntent(delete)
        .setPriority(Notification.PRIORITY_HIGH)
        .setVibrate(new long[0]);

notificationManager.notify(1, nb.build()); // TODO hardcode

我第一次在测试设备上安装应用程序时,通知会抬头,但是如果我扩展通知区域(抬头仍在运行时)并从那里取消通知,则下次通知不会抬头.重新安装应用程序后,通知会再次提示.抬头行为不能始终保持任何原因吗?

First time I install application on a testing device, notifications are heads up, but if I expand notification area (while heads up is still running) and dismiss the notification from there, next time notifications are not heads up. After reinstalling the app notifications are heads up again. Are there any reasons why heads up behaviour can not be constant?

推荐答案

抬头通知具有内置的速率限制-如果用户将抬头的通知向上(将其放回通知托盘)或向侧面滑动(将其关闭),然后向系统发送信号,以在一段时间(默认为一分钟左右)内阻止进一步的抬头通知.

Heads up notifications have a built in rate limiting - if the user swipes your heads up notification up (putting it back into the notification tray) or to the side (dismissing it), then that signals the system to prevent further heads up notifications for some period of time (~a minute by default).

这篇关于抬头通知有时不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆