0

I spent a lot of time to groped to solve the problems related to GCM and the backwardness of push notifications.

My Android App receives push messages but also after 24 hours that have been shipped through my PHP server with CURL function.

I already tried to set the time_to_live to 0 or 86400 and delay_while_idle both true to false without any kind of feedback, messages continue to arrive late.

I have already tried the Push Notification Fixer then setting the sending heartbeat every 5 minutes without any benefit.

I imagined that if the device in standby (so with outstanding Internet) via a scheduled task (timer, AlarmManager or other ..) when sending the heartbeat maintained active connection to the Internet device (so let's say every 5 minutes) may receive message.

But how long it is necessary that the connection is active because GCM notices that the device is online and send messages in the queue?

This problem also afflicts FCMas well as GCM?

Thank you.

Arjun saini
  • 4,223
  • 3
  • 23
  • 51
Daniele
  • 177
  • 14
  • Its a well known problem with GCM. After a long time struggling with it, I tested one signal and its pretty good and you dont have to do a lot of changes in your code for one signal. You can have a look here https://documentation.onesignal.com/docs/using-onesignal-in-your-android-app – Zaartha Jun 22 '16 at 10:19
  • Thanks for the report, but the goal is to just use GCM (or FCM, if you prefer) to not bind to third party services. – Daniele Jun 22 '16 at 13:36

1 Answers1

0

I think there is no definite/exact answer in how much time or how many minutes is necessary to receive a push notifications from a GCM. Because like you said, a push notification can set its options to receive the message like:

  • priority - if you set the priority of a GCM to high, other than wake up a sleeping device it also delivers the message to the device as soon as possible without any delay. And if you set the priority to normal, it won't open network connections on a sleeping device, and their delivery may be delayed to conserve battery.

  • delay_while_idle flag - GCM usually deliver messages immediately after they are sent. However, this might not always be possible. For example, if the platform is Android, the device could be turned off, offline, or otherwise unavailable. Or the sender itself might request that messages not be delivered until the device becomes active by using the delay_while_idle flag. Finally, GCM might intentionally delay messages to prevent an application from consuming excessive resources and negatively impacting battery life.

source : GCM documentation

Also, just take note that internet and wifi connection also affects the time of push message.

If you want the average speed of the push message, just check the video in the answer of this SO question.

For more information check this page and this SO question.

Community
  • 1
  • 1
KENdi
  • 7,576
  • 2
  • 16
  • 31
  • Yes I know. The problem is that when the device is on standby and the data connection has limited the arrival delay is really important, up to several hours or a whole day. This needs to be resolved by the App waking up the device every now and for some time to send the heartbet and wait for the queued messages to GCM arrive. Well, how long the device needs to receive messages in order to put to sleep, and so consume less battery? – Daniele Jun 24 '16 at 16:16