I am testing the Firebase JSON to check the delivery receipts of the notification sent to the news app. I can successfully send the message to the Android app without any issues and I receive the message on my Android app. However, I want to know how and where can I check if the notification was successfully delivered to the Android app?
How do I use the message_id
and/or multicast_id
that is given back to get the delivery status of the notification? I can't find working code examples of checking for delivery status with Firebase. Does anyone have working JSON code to query the delivery status of a Firebase message via the message_id
and/or multicast_id
or another way? The Firebase documentation does not give examples on how to do this (or maybe I missed the example).
Please see the Firebase JSON below used to send the notification to the Firebase news app. Anyone's help is highly appreciated.
In the header I set authorization key=firebase_server_key
and content type is set to application/json
{ "to" : "token received from firebase", "notification" : { "body" : "test", "title" : "Alert", "icon" : "myicon", "delivery_receipt_requested": true } }
Output from postman:
{"multicast_id":7845213569874521,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:4853214789631%31bd1c9631bd1c96"}]}
It's possible. Two approaches. First is you make use of the collapse_key parameter to set the message as a collapsible message.
Firebase notifications behave differently depending on the foreground/background state of the receiving app. If you want foregrounded apps to receive notification messages or data messages, you'll need to write code to handle the onMessageReceived callback.
Update:
The Diagnostics Tool has been removed since Nov. 30, 2017:
You can no longer access FCM diagnostics data in the Play Console.
Confirming what @user7410521 said in the comments section. There is currently no available API to make use of the message_id
s/multicast_id
s to retrieve the details of the delivery status of the message sent, other than using the FCM Diagnostics Page. Do also keep in mind that the Diagnostics page is only usable when the app is already published (for Alpha testing or later).
I noticed that you included the delivery_receipt_requested
parameter in your payload. Receiving the a message confirmation should be enough to determine that the device received the message.
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