Blo*_*oss 6 firebase flutter firebase-cloud-messaging
我尝试实现这样的组通知android group notification和ios group notification。但我做不到。我也试过这个flutter_local_notification插件。但这仅在应用程序打开时有效。不在前台(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);
}
Run Code Online (Sandbox Code Playgroud)
有效载荷
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,
};
Run Code Online (Sandbox Code Playgroud)
解决方案
我看到了对此的 react-native 答案,您必须使用 Flutter 和react native 答案做同样的事情firebase_messaging
小智 -1
如果你想提交一个组,你需要订阅一个主题,在提到它的文档中,你将不再发送单个令牌,而是订阅一个主题并将其提交到该主题。
归档时间: |
|
查看次数: |
2221 次 |
最近记录: |