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 通知分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Android FCM 通知分组
基础教程推荐
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
