Google Cloud Messaging (GCM) does not deliver when the device is reconnected to the network

I am developing an Android application using GCM. I am currently using the standard client and server Google libraries. If I test on two Android devices, GCM works fine when both devices are turned on whether my application is running or not.

However, if device A is turned off, and I send messages to it from device B when device A, turned on on it, does not receive messages sent during its absence.

On the server side (which initiates the actual sending), each message to device A does not have collapse_key , time_to_live set to 2000000 (just in case for testing purposes). Actual sending has an attempt set parameter of 50 (in case GCM itself is unavailable, however this is unlikely).

Do I need to complete the GCM registration procedure when booting the device? I am currently doing this.

Please note that the GCM receiver and GCMIntentService are set in the same way as the permissions in the manifest, as described on the Google website.

Any advice would be highly appreciated. I am really stuck in this problem.

+7
source share
2 answers

Sorry guys. It was my fault. General preferences were not loaded properly, which caused the GCMIntentService to work. Messages are going fine.

So solved

+1
source

Do I need to complete the GCM registration procedure when the device boots up?

No, you do not.

In our project, we have no problems receiving messages that were sent when the device was turned off or turned on. We do not use the Google libraries and do not do everything as described on the gcm homepage. In addition, we do not set collapse_key and time_to_live for our messages.

By the way, are you handling message_type ? My be GCM will notify you that the message has been deleted

0
source