I am using GCM service to send some notifications in my android application.The notifications are pushed to other android device perfectly if that device is online(Use wi-fi or mobile data).But if that device is offline, then the GCM push notifications does not get to that device after it get online.Is there any code that I should add specifically to do this task or any other configurations to be configured?
In order for your message to be delivered on a device (that is currently offline) when it goes online. You can check the Time-To-Live parameter in your request. This parameter tells the GCM storage how long (in seconds) the message should be kept if the device is offline. It can be set up to a maximum 4 weeks which is also the default value if you don't specify one.
Related
When i try to send notification when target device internet connection is off and next turn on internet connection i receive no notification.
There is no problem with notifications when device is online.
This is standalone Expo aplication with FCM notifications.
Based on FCM docs it should work.
...When this happens, FCM stores the message and delivers it as soon as it's feasible
Tested on two different devices, same result. Any idea?
Can't believe. This is just default expo ttl settings.
...Time to Live: the number of seconds for which the message may be kept
around for redelivery if it hasn't been delivered yet. Defaults to 0.
I have implemented a server which will send some alerts to android devices. For most of devices, Notifications are getting received. However there are few devices to which notifications could not be delivered?
I would like to know if there is way to get list of such a devices for which notifications delivery was failed?
Does GCM provides this data(List of devices for which notifications delivery was failed)?
However there are few devices to which notifications could not be delivered.
If your devices don't receive notifications, try the following workarounds:
Make sure you've set your SENDER ID you've received from Google correctly.
Make sure your device was registered with Google's GCM service correctly.
Make sure you are sending the push to the correct reg id you've received from Google, and that you didn't receive an error from Google GCM service.
If you set the delay_while_idle = 1, the message won't reach the device if it's idle (off, offline, locked screen, etc...). Change it to delay_while_idle = 0 if you want your wakelock permission to make any difference.
Some times it takes time for the push to arrive, but if there is too much time, then there is a problem. Check what's the time_to_live of the push you've sent.
I would like to know if there is way to get list of such a devices for which notifications delivery was failed?
Based also from this thread, Google only provide some statistics that are available on the android developer console. This only shows the number of messages and registrations.
You would have to implement your own data collection, which could be done fairly easily. You could record the time & id of each message sent and have your android client report back to your server with the time of message receipt. You could then store the data on your server and query as needed.
You can check this View & diagnose Google Cloud Messaging (GCM) statistics link to know your GCM message status.
I am testing an apps. Push notification is working fine in our server environment. But in client's environment, large amount of Android devices (NOT ALL) do not receive any push notification.
What is the possible factor? the return status form GCM is "Failed"
the return status from GCM is "Failed"
Android Device which is Receiving push must be online, if not GCM will pool notifications till it reached a mark of 100, It will start clearing the pool if more notification arrives at their end
large amount of Android devices (NOT ALL) do not receive any push notification.
Did you check you have correct GCM ID with each device? If not The device will never receive a single notification. If your device have a valid GCM ID and have received some notification then it must be a problem in connecting with the device.
Also device must have Latest Play Services installed to get the notification on board
In my android application , i use push notification .I had one if there is no network connection in my android device means .Then push notification works or not in my android device
If the target device is not connected to the internet, then the GCM adds the Notifications to a pipeline to be delivered at a later stage. There are limitation on the pipeline size and the maximum time of un-connectivity, after which GCM aborts the pending GCM messages. But for a general case, this should do the needful.
You need Internet Connection.
GCM clients receive notifications through a socket, which is handled by Google Services to the Internet
Without Internet you will not receive any notification from GCM. Till your connection is not there GCM fill store all notification for you and as soon as you got connected it will release its burrer
I am developing app on Android GCM push notification. Everything works fine .But I am not able to get the notification message when my device is on wifi rather than on data plan of service provider. In my case data plan is 3G but and notification comes as usual to devices but when device is connected through wifi I am not able to get any notifications.
Well this should not be the case, I have an android app that receives GCM push notifications regardless it is connected via 3G or Wi-Fi.
What I would suggest to troubleshoot this problem:
When you send the push notification from the server make sure to NOT include delay_while_idle, so the notification get delivered right away. Also make sure you have set time_to_live to a reasonable value (default is 4 weeks)
Try to hold a Wi-Fi lock in your app
Test with different device and/or Android version (maybe it is a problem with certain hardware/API version)