Android FCM 通知分组

Android FCM notification grouping(Android FCM 通知分组)
本文介绍了Android FCM 通知分组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为聊天应用实现 FCM 通知,我想实现类似 WhatsApp"的通知,其中通知将按对话分组.

I was trying to implement FCM notification for a chat app and I want to achieve "WhatsApp-like" notification where the notification will be grouped by conversation.

假设当 Alice 回复与 Bob 在里面的对话时,Bob 将收到一条正文为Alice:内容"的通知.但是,如果 Alice 再次快速回复对话,Bob 将收到另一个新通知,但我只想将新回复附加到 prev 通知上.

Say when Alice replied to a conversation with Bob inside, Bob will receive a notification with the body "Alice: the content". But if Alice quickly reply to the conversation again, Bob will get another new notification but I just want to append the new reply onto the prev notification instead.

我怎样才能做到这一点?

How can I achieve that?

推荐答案

通过 grouping 通知,我假设您的意思是 stacking 或 捆绑通知.

By grouping the notification, I'm presuming you mean stacking or bundling notifications.

更多关于如何在客户端应用中处理通知.您只需使用 setGroup() 将所有通知添加到一个组,然后调用 notify() 让 NotificationManager 进行更改.

This is more on how you handle the notification in your client app. You simply have to make use of the setGroup() to add all your notifications to a single group then calling notify() to let the NotificationManager of the changes.

这个将每个通知添加到一个组文档差不多总结了这一切.

This Add Each Notification to a Group documentation pretty much sums it all up.

这篇关于Android FCM 通知分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)