NotificationManager

1.、NotificationManager 稱作通知管理器,是負責通知的管理。

2、


方式來獲取notification管理器,或者


3、notificationManager的主要使用方法notifiy和cancel兩個方法

3.1: notifiy(int id,Notification) 來更新notification,如果id已經存在,則更新;如果不存在,則新建。

如官網給出的解釋


3.2 :cancel(int id) 取消制定id的notification。例如當通知欄上面有個id爲1和2的通知,cancel(1)將只會取消id爲1的通知欄。 

3.3:notify(String tag, int id, Notification notification),將通知欄加入狀態欄,標籤爲tag,標記爲id。有相對應的cancel(String tag,int id)

方法。

demo

      

發佈了13 篇原創文章 · 獲贊 1 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章