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

vojta picture vojta · Aug 18, 2016 · Viewed 7.1k times · Source

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?

Answer

muhanna hamiad picture muhanna hamiad · Aug 18, 2016

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