I am trying to send a push update to some android devices. Some of them have got a new id in the mean time, so I Google tells me there are canonical ids. From the documentation I read:
If message_id is set, check for registration_id:
- If registration_id is set, replace the original ID with the new value (canonical ID) in your server database. Note that the original ID is not part of the result, so you need to obtain it from the list of registration_ids passed in the request (using the same index).
Am I missing a part, or is this ambiguous if you send more than 1 registration id to Google?
My request (replaced ids for readability):
"{"data":{"favorite":1},"registration_ids":["1","2","3","4","5","6"]}"
The response from Google is:
{
"multicast_id":7917175795873320166,
"success":6,
"failure":0,
"canonical_ids":4,
"results":[
{"registration_id":"3","message_id":"m1"},
{"message_id":"m1"},
{"message_id":"m1"},
{"registration_id":"3","message_id":"m1"},
{"registration_id":"3","message_id":"m1"},
{"registration_id":"3","message_id":"m1"}
]
}
From this, I know that id 3 is correct, but which original ids should I replace with 3? Sending every message for every registered id would be a waste. I have read a post here on Stackoverflow ( GCM and id handling ) solving it for a Java server, but mine is not (RoR).
Any ideas on how to solve this issue?