【问题标题】:How to selectively delete Android Firebase Notifications (in the System Tray)如何选择性地删除 Android Firebase 通知(在系统托盘中)
【发布时间】:2017-05-15 10:16:17
【问题描述】:

根据documentation,Firebase for Android 通知会在应用处于后台时发送到系统托盘。

如何检索所有通知并根据某些逻辑有选择地删除通知? (当然,我会确定逻辑,但是如何检索和识别它们呢?)

使用 NotificationManager 删除系统托盘中的通知是否正确?

任何代码示例都将不胜感激。谢谢!

【问题讨论】:

  • 使用 NotificationManager,AFAIK,是唯一的方法。

标签: android firebase push-notification android-notifications firebase-cloud-messaging


【解决方案1】:

我们遇到了同样的问题,我们通过不发送通知正文解决了这个问题。

https://firebase.google.com/docs/cloud-messaging/android/receive

正如文档中提到的,当没有通知正文时,您只会在您的FirebaseMessagingService 中收到方法public void onMessageReceived(RemoteMessage remoteMessage) 的消息。否则它会落到系统托盘上,由 android 处理。

虽然无法从控制台发送没有通知正文的通知。您必须构建自己的后端。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-08-28
    • 1970-01-01
    • 2017-02-03
    • 2018-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-10
    相关资源
    最近更新 更多