Reputation: 515
I am facing a strange problem. I am getting push notification in my mobile, if it is connected to the internet at that point when message has been send from the server side. But if it is not connected to the internet at that time and rather I am connecting to internet after some time. I am not receiving that notification. According to my knowledge all those notifications should show whenever we are online, because GCM server stores all those messages. I am receiving notification for all other apps. Also I have given wakelock permission in manifest. What might be the problem? Anything from server side, client side or mobile? Please help...
This value is send to GCM server from 3rd 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() + "®istration_id=" + deviceToken + ""
Thanks in Advance
Upvotes: 7
Views: 6120
Reputation: 393771
delay_while_idle=1
contradicts Also I have given wakelock permission in manifest
delay_while_idle=1
means the message won't reach the device if it's idle (off, offline, locked screen, etc...). Change it to 0 if you want your wakelock permission to make any difference.
Just to clarify - the message should reach the device after it stops being idle (as long as it hadn't been idle for too long, where "too long" is determined by the specified time_to_live
).
Here's the relevant quote from GCM documentation :
delay_while_idle
If included, indicates that the message should not be sent immediately if the device is idle. The server will wait for the device to become active, and then only the last message for each collapse_key value will be sent. Optional. The default value is false, and must be a JSON boolean.
time_to_live
How long (in seconds) the message should be kept on GCM storage if the device is offline. Optional (default time-to-live is 4 weeks, and must be set as a JSON number).
Upvotes: 10