Once did not receive GCM push notification in mobile phone

I got a strange problem. I get a push notification on my mobile device if it is connected to the Internet at the moment the message was sent from the server. But if it is not connected to the Internet at that time, and rather, I connect to the Internet after a while. I do not receive this notification. According to my information, all these notifications should be displayed whenever we are online, because the GCM server stores all these messages. I receive a notification for all other applications. I also gave permission to wakelock in the manifest. What could be the problem? Anything from the server, on the client side or on the mobile? Please, help...

This value is sent to the GCM server from a third-party server (.Net server):

String postdata= "collapse_key=score_update&time_to_live=2419200&delay_while_idle=1&data.message=β€Œβ€‹" + message + "&data.time=" + System.DateTime.Now.ToString() + "&registration_id=" + deviceToken + "" 

Thanks at Advance

+7
source share
1 answer

delay_while_idle=1 contradicts Also I have given wakelock permission in manifest

delay_while_idle=1 means that the message will not reach the device if it is idle (turned off, disabled, the screen is locked, etc.). Change it to 0 if you want your wakelock permission to have any meaning.

Just to clarify - the message should reach the device after it ceases to be inactive (if it has not worked for too long, where "too long" is determined by the specified time_to_live ).

Here's the appropriate quote from the GCM documentation:

delay_while_idle

If enabled, indicates that the message should not be sent immediately if the device is in standby mode. The server will wait until the device becomes active, and then only the last message for each collapse_key value will be sent. Optional. The default value is false and there must be a JSON boolean value.

time_to_live

How long (in seconds) the message should be stored in the GCM repository if the Device is offline. Optional (the default lifetime is 4 weeks, and be set as a JSON number).

+10
source

All Articles