0

When I send notification to Device Groups I get the following response

{
  "success": 2,
  "failure": 0
}

I wanted to simulate partial success (https://developers.google.com/cloud-messaging/notifications#http_response) so that I can test my retry logic. A response like below-

{
  "success":1,
  "failure":2,
  "failed_registration_ids":[
     "regId1",
     "regId2"
  ]
}

How should I do that?

1 Answers1

0

In order to have a "partial success" response, you need to have not_registered_ids and/or invalid_registration_ids. A "not registered id" is a registration id that was valid. According to GCM documentation: "An existing registration token may cease to be valid in a number of scenarios...". You can try the following to have a partial successful push:

  • Client app unregisters with GCM.
  • Client app is automatically unregistered, which can happen if the user uninstalls the application.
  • Client app is updated but the new version is not configured to receive messages.

A partial successful push may also have to_be_retried_ids so that the user can retry these specific registration ids as they failed because the server returned with InternalServerError or Unavailable.

abielita
  • 13,147
  • 2
  • 17
  • 59
  • Tried all the scenarios you mentioned to get `partial success`. But in all the cases their are no failures. Only the no of success decreases as if the registration id is removed from the group. – satyen vishnoi Apr 12 '16 at 08:54
  • This might help you. http://stackoverflow.com/questions/30496492/what-is-a-good-way-to-return-a-partial-success-response-for-a-rest-api – abielita Apr 12 '16 at 11:11