Android FCM 通知分组 [英] Android FCM notification grouping

本文介绍了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 通知分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆