we have recently set up GCM for an application for push notifications. The server api is in Node.js so I am using the node module node-gcm for pushing the notifications to gcm server.
We noticed sometimes the packets were not getting delivered to the end user. After doing some search, I tweaked some of the settings which helped a lot to improve the reliability
I changed the older settings to the following new settings:
delayWhileIdle flag from true to false,
collapseKey to time of day instead of 'demo'
timeToLive to 7200 instead of 3
I also read about canonical id's. The google's page "A canonical registration ID is defined to be the ID of the last registration requested by your application. This is the ID that the server should use when sending messages to the device."
I logged the result while sending the message. The canonical id in the result was 0. What does this mean ? Here is the result:
{
multicast_id: 9180653668551804000,
success: 1,
failure: 0,
canonical_ids: 0,
results: [ { message_id: '0:1415521804106240%0209acc19067cebd' } ]
}
The post here on stackoverflow suggests to replace the registration id with the canonical id. I am not clear on when to replace and when not to.
In my server's database reg_id is requested when app is installed and stored with the user's record in the database. Also what are these fields like message_id and multicast_id in the result ?