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
If restarting your phone didn't do the job, one of the most common reasons notifications don't show on Android is because of the notification settings of the app in question. It's possible that you may have mistakenly messed up with the default notification settings, and so now you're not receiving them properly.
Google Cloud Messaging (GCM) was a mobile notification service developed by Google that enables third-party application developers to send notification data or information from developer-run servers to applications that target the Google Android Operating System, as well as applications or extensions developed for the ...
You may have accidentally turned off either the system notifications or the app's push notifications. Go to settings and make sure both of these options are enabled. To enable an app's notifications, turn on the show notifications trigger.
Turn on notifications for Android devicesTap More on the bottom navigation bar and select Settings. Tap Turn on notifications. Tap Notifications. Tap Show notifications.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With