Closed breaklee closed 8 years ago
If you try to send a notification to a device and get an error "NotRegistered"
it means that it has been deleted.
It is your own responsibility to make sure that your app informs your server that a registration id has been removed.
That is nice but when you are sending 1000s at a time is there a way to know which one is not registered. Thanks
@sunojvijayan Yes, you can match the returned result to a specific registration ID via its index in the array.
For example, if you send a push to 5 registration IDs, the results array will be populated with indexes 0 to 4 each relating to the registration IDs you provided, in the same order you sent them.
A more concrete example of what @eladnava describes:
If you registration ids are [ "A", "B", "C", "D", "E" ]
and "C"
is no longer registered, the response will look something like this:
{
"multicast_id": "something",
"success": 4,
"failure": 1,
"results": [
{ "message_id": "something" },
{ "message_id": "something" },
{ "error": "NotRegistered" },
{ "message_id": "something" },
{ "message_id": "something" }
]
}
Notice that the response with error
has index 2
--- this maps to the index 2
of your registration IDs, ie. "C"
.
The spec can be found here: https://developers.google.com/cloud-messaging/http-server-ref#table5
Thank you guys. Great work.
i want to delete tokens already deleted in mobile apps. how do i know this situation?