Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check the delivery status of Firebase message sent to an Android application? [duplicate]

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"}]} 
like image 547
support ecommunicate Avatar asked Jan 17 '17 15:01

support ecommunicate


People also ask

Can FCM notification on Android overwrite previous one?

It's possible. Two approaches. First is you make use of the collapse_key parameter to set the message as a collapsible message.

How do you handle notifications when an app is in foreground in Firebase?

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.


1 Answers

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_ids/multicast_ids 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.

like image 132
AL. Avatar answered Oct 04 '22 15:10

AL.