Reputation: 127
I am sending push notifications on server side and I am using this http protocol(https://firebase.google.com/docs/cloud-messaging/http-server-ref) and I want to add action buttons like this in issue https://github.com/FirebaseExtended/flutterfire/issues/1484. This is my request body
{
"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",
}
}
I tried this but nothing show up. How can I solve this issue? Thank you in advance.
Upvotes: 6
Views: 11309
Reputation: 592
FCM doesn't support this functionality right now. The solution would be to send a data message via FCM and create your own notification.
"data": {
"key": "value",
"key2": "value2"
}
FirebaseMessagingService
.onMessageReceived
callback to create notification based on your data message.https://firebase.google.com/docs/cloud-messaging/android/receive
Upvotes: 5