1.普通通知

android中三种notification管理

android中三种notification管理

2.折叠通知

①折叠通知通过设置自定义的通知view,实现通知view和app的交互。

在通知中通过广播和service之间进行通讯。这时候要在service中注册广播

 

android中三种notification管理android中三种notification管理

android中三种notification管理

在service中注册广播,当上面调用expanedView.setOnclickPendingIntent()的时候,就会发送广播到达service中,这样就可以进行控制音乐等的播放。android中三种notification管理

②更新通知中的内容,比如通知栏中音乐播放和暂停等按钮的变换,注意要使用同一个notificationId.

android中三种notification管理

3.悬挂通知

android中三种notification管理

android中三种notification管理

android中三种notification管理

 

demo地址:

https://github.com/yunzheyue/notificationTest

 

相关文章:

  • 2021-06-27
  • 2021-05-31
  • 2021-06-23
  • 2021-11-14
  • 2022-12-23
  • 2022-03-09
猜你喜欢
  • 2021-08-01
  • 2021-05-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-21
  • 2022-12-23
相关资源
相似解决方案