【发布时间】:2019-06-09 20:42:19
【问题描述】:
我一直在尝试按 id 对通知进行分组,以将它们显示为 WhatsApp,例如,每行没有一个通知。
在onNotification 或onNotificationDisplayed 中添加setGroup 似乎无效,请参见以下示例:
1
componentDidMount() {
this.notificationListener = firebase.notifications().onNotification(async (notification) => {
// Process your notification as required
notification.android.setAutoCancel(true)
notification.android.setGroup(notification.data.channelId)
notification.android.setGroupSummary(true)
}
}
2
componentDidMount() {
this.notificationDisplayedListener = firebase.notifications().onNotificationDisplayed((notification) => {
notification.android.setGroup(notification.data.channelId)
notification.android.setGroupSummary(true)
});
}
知道如何按 id 对它们进行分组吗?
【问题讨论】:
-
您确定每个通知的 notification.data.channelId 都保持不变吗?
-
是的,每个通知都一样
标签: react-native firebase-cloud-messaging android-notifications firebase-notifications react-native-firebase