我正在服务器端发送推送通知,并且我正在使用这个 http 协议(https://firebase.google.com/docs/cloud-messaging/http-server-ref)并且我想添加像这样的操作按钮https://github.com/FirebaseExtended/flutterfire/issues/1484。
这是我的请求正文
{
"registration_ids": [
"secret"
],
"notification": {
"title": "New Article",
"body": "Article content",
"sound": "default",
"actions": [
{
"action": "like-button",
"title": "Like",
"url": "https://example.com"
},
{
"action": "read-more-button",
"title": "Read more",
"url": "https://example.com"
}
],
"click_action": "read-more-button"
},
"data": {
"id": "some uuid",
}
}
我尝试了这个但没有任何显示。我该如何解决这个问题?先感谢您。
FCM 目前不支持此功能。解决方案是通过 FCM 发送数据消息并创建您自己的通知。
- 使用您自己的键值对发送数据消息:
"data": {
"key": "value",
"key2": "value2"
}
- 接收消息,使用扩展的服务
FirebaseMessagingService
.
- 覆盖
onMessageReceived
回调以根据您的数据消息创建通知。
https://firebase.google.com/docs/cloud-messaging/android/receive
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)