GcmListenerService delivery callbacks
In some situations, when there is no connectivity with the GCM servers due to lack of network connectivity, the message could remain on the local queues for a long period of time. So, in order to discard a message that remains on the queue without being sent to the GCM Service within the time specified, the GoogleCloudMessaging
API provides an additional send method that could receive a TTL (Time to Live) time to set the message expire time:
void send (String to, String msgId, long timeToLive, Bundle data)
This works great when you have messages that are only relevant if they arrive within a certain time frame. With a time to live of 0, we'll attempt to send and return an error immediately if we're not connected. This situation does not apply for our example, so we will keep the original code with the send method that does not discard an old unsent message.
It is important to understand that the application GCM client is only able to queue a maximum of...