通过设置FLAG_INSISTENTFLAG_ONGOING_EVENT 标志位可以让Notification成为持续或正在进行的Notification

 

Notification标记为ONGOING,如下面的代码所示,它就能用于表示当前正在进行的事件(如来电)。正在进行的事件与“普通的”Notification区别在扩展的状态条窗口中。

 

notification.flags = notification.flags | Notification.FLAG_ONGOING_EVENT;

 

持续的Notification一直重复,直到用户取消。下面的代码给出了如何设置Notification为持续的:

 

notification.flags = notification.flags | Notification.FLAG_INSISTENT;

 

持续Notification反复重复开头的Notification效果,直到用户取消。持续的Notification应该保留给如闹钟的情形,它需要及时的采取响应。

相关文章:

  • 2021-10-18
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2021-08-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-09
  • 2021-07-31
  • 2021-05-17
  • 2022-12-23
相关资源
相似解决方案