且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

仅当用户在计算机上时才显示通知

更新时间:2022-04-22 22:23:39

如果用户离开他们的计算机,他们不想找到20个不执行操作的提醒。

技术我不知道如何看待不活动,但我想你可以使用超时通知在一段时间间隔后关闭自己和/或限制显示的通知少,所以最新的将自动关闭最旧的一个

Technicaly I don't know how to watch for inactivity but I think you could use timeout for notifications to close themselves after a time interval and/or to limit displayed notifications to few, so the newest one would automaticaly close the oldest one.

苹果文档


注意:用户在计划的
通知被调度为触发超过15分钟后,它被丢弃。如果
通知以小于15分钟的间隔重复,则
在1分钟后到期。已过期的通知只会被舍弃,除非他们重复
,在这种情况下,他们仍然在预定的列表中,只是
稍后再次触发。

Note: It the user wakes more than 15 minutes after a scheduled notification is scheduled to fire, it is discarded. If the notification repeats with an interval less than 15 minutes, then it expires in 1 minute. Expired notifications are just discarded, unless they repeat, in which case, they stay in the scheduled list and just fire again later.