I'm trying to add an action button to notifications produced on firebase 9.0.0, for Android, when app is in background.
Any ideas?
Thanks!!
firebase-cloud-messaging doesn't provide an API to add action buttons to the notifications.
You can request new features to the firebase library here: https://firebase.google.com/support/contact/bugs-features/
For now what you can do is to send a data-message
with a custom payload via the server-side API
You can then receive that payload in onMessageReceived() and generate your custom notification.
So in order to customize notifications when app is on background, as Diego mentioned, the only current way is to create the notification yourself. Adding "data" key to notification payload, results in onMessageReceived()
callback, on which you can create any notification andy notify.
Thing is, I tried to send a notification from Firebase console, rather then from the API. There I couldn't add the data key properly and catch it. From API all works fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With