Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Cloud Messaging - "success" and "failure" in response JSON

I use Firebase Cloud Messaging to deliver notifications to my Android client apps, each notification should be sent to a single device according to its registration token.

Each time I send a notification via https://fcm.googleapis.com/fcm/send, I receive a JSON response like this one:

{
  "multicast_id": 108,
  "success": 1,
  "failure": 0,
  "canonical_ids": 0,
  "results": [
    { "message_id": "1:08" }
  ]
}

I find success and failure redundant - don't they mean the same thing? Should I check both of them to be sure everything is fine? Is it always true that success != failure?

like image 595
vojta Avatar asked Aug 18 '16 10:08

vojta


1 Answers

As described here :

success - Required, number of messages that were processed without an error.

failure - Required, number of messages that could not be processed.

You get : "success": 1, which means 1 message was processed successfully and "failure": 0, which means no error

like image 127
muhanna hamiad Avatar answered Sep 30 '22 16:09

muhanna hamiad