我尝试像这样实现群组通知Android 群组通知 https://developer.android.com/training/notify-user/group and iOS群组通知 https://developer.apple.com/videos/play/wwdc2018/711/。但我做不到。我试过这个颤振本地通知 https://pub.dev/packages/flutter_local_notifications插件也是。但这仅在应用程序打开时有效。不适用于前台(onResume)和后台。
void registerNotification() {
_fcm.configure(
onMessage: (Map<String, dynamic> message) {
return;
},
onResume: (Map<String, dynamic> message) {
return;
},
onLaunch: (Map<String, dynamic> message) {
return;
},
onBackgroundMessage: backgroundMessageHandler);
}
payload
const payload = {
notification: {
title: title,
body: message,
},
data: {
click_action: "FLUTTER_NOTIFICATION_CLICK",
sound: "default"
},
android: {
priority: "high",
collapse_key: userName,//tried to add collapse_key for group notification
},
apns: {
headers: {
"apns-priority": "5",
},
},
token:token,
};
SOLUTION
我看到了反应本机的答案,你必须使用 Flutter 做同样的事情firebase_messaging
反应原生答案 https://github.com/invertase/react-native-firebase/issues/449#issuecomment-404701979