有人知道我是否需要管理Flutter Firebase消息传递示例中的数据id
和status
选项吗?
我似乎找不到在https://pub.dev/packages/firebase_messaging或https://firebase.google.com/docs/cloud-messaging/concept-options#notification-messages-with-optional-data-payload
提到的内容 Fltter文档中的curl
示例如下:
DATA='{"notification": {"body": "this is a body","title": "this is a title"}, "priority": "high", "data": {"click_action": "FLUTTER_NOTIFICATION_CLICK", "id": "1", "status": "done"}, "to": "<FCM TOKEN>"}'
curl https://fcm.googleapis.com/fcm/send -H "Content-Type:application/json" -X POST -d "$DATA" -H "Authorization: key=<FCM SERVER KEY>"
我正在尝试确定是否需要管理后端服务中的id
和status
值。看起来像,但是其他人在做什么呢?
谢谢。
答案 0 :(得分:0)
数据字段只是任意键值有效负载,id
和status
只是示例,请参见:https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#Message.FIELDS.data
请注意,提供的curl示例使用的是旧版HTTP协议。
当data.click_action
或notification.click_action
为"FLUTTER_NOTIFICATION_CLICK"
时,firebase_messaging将事件传递给扑打,请参阅: https://github.com/flutter/plugins/blob/4f0c5dd2bd30673446a8d511f7a791af9757eb3e/packages/firebase_messaging/android/src/main/java/io/flutter/plugins/firebasemessaging/FirebaseMessagingPlugin.java#L179-L208