I am observing a problem described in details here:
https://github.com/firebase/quickstart-android/issues/83
It appears to be closed without any apparent reason or solution.
Looking into the syslog of my Nexus I am seeing that the connection between smartphone and FCM server gets reset after some inactivity period. This results in what was described in #83, and it was actually discussed quite vigorously here many years ago:
https://productforums.google.com/forum/#!topic/nexus/fslYqYrULto
After all those years with the most recent Android software, I am stumbling on the same issue.
Does anyone know how to modify the keep-alive rate in Android so that using FCM would make any practical sense? I am particularly interested in how to make it work with Cordova based apps.
Ironically, I am having iOS devices here sitting along with the Androids - none of the iPhones misses a single message while Androids loose the connection to its own service provider every few minutes of idleness...
I am experiencing the same issue, i'll be sending messages from my server to the device with no problem at all. I'll come back in 5 minutes and try sending another message but nothing is received for minutes->hours where it'll suddenly work again. No idea why it was closed and locked!
I have spent substantial amount of time chasing this issue into the core and I found what is going on. At least on my network. This is not an FCM problem but an Android OS problem and the solution is yet to be found.
In order to keep a live socket with an idle connection, there must be some kind of keep alive message from a client. It is important on some networks to indicate that you are still active. Otherwise they just close the connection to save the resources. My silly home router does that for no apparent reason and I can't find a way to twitch this. Many cellular carries do this too. It really depend on the provider.
I looked into the syslogs of my telephone and found that Android keeps loosing the connection to FCM because its heart beat with the service is way to rare (15 minutes on Wifi network). By the time Android client wakes up to ping the server, the connection is long gone and only now it starts to re-connect. This results in many minutes of random sporadic behavior. Very frustrating. iOS on the other hand do the heart beat more often and never seem to loose the line. It's that simple.
There are more frustrated developers out there, it's being for quite some time:
https://productforums.google.com/forum/#!topic/nexus/fslYqYrULto
https://eladnava.com/google-cloud-messaging-extremely-unreliable/
And because Google don't want to fix this, the developers make stuff like this:
https://play.google.com/store/apps/details?id=com.andqlimax.pushfixer
https://play.google.com/store/apps/details?id=com.elotro.pushheartbeat
.. which work but it's not a solution.
@sparklton thank you for the very detailed explanation. I am going to forward this on to the FCM team and see if they're aware/have a suggestion.
In the meantime I am going to close this issue since it's not really related to the code in this repository, but I will update the issue if anything interesting comes up.
Hey all, apologies for the delayed response. I talked to the FCM team and learned a lot about this issue.
In the majority of cases these types of problems are caused by the network infrastructure. FCM uses a dynamic heartbeat so to simply reduce the heartbeat interval (like those apps do) would use much more battery for the average user and not make things much better in most cases.
If either of you can still reproduce this issue and feels comfortable sending a full Android bugreport to me ([email protected]) I can provide it to the FCM team for more investigation.
I am also facing same problem.Some times push notifications are getting so fast.Some times its huge delay
Please help me how to fix it.
@VyshuRaj Please file a support request with Firebase Support since it seems you are implementing FCM correctly on your end so more troubleshooting is necessary.
Any fix for this problem?
@razam217 FCM is currently operating normally. For status of FCM see the Firebase status dashboard. If you are having issues please file a support ticket.
I have the same problem, it delays message sometimes minutes. iOS devices do not face with this issue in the same network that my android devices in. So I do not think the problem is about network. iOS devices have no delay under same condition.
@ilyasdirin what is the target of the messages you are seeing the delays with?
It targets only one device with high priority. The problem is that when I change network (from 4G to Wifi or vice verca) I am not able to get FCM about at least one minute. I'am sharing the request below. Is there any way to notify FCM when the connected network change?
POST /fcm/send HTTP/1.1
Host: fcm.googleapis.com
Authorization: key=ServerKey
Content-Type: application/json
cache-control: no-cache
Postman-Token:
{
"priority" : "high",
"data": {
"my_data": "123456",
},
"to": "FirebaseToken"
}
@ilyasdirin That payload looks good to me. There is nothing on the API side that can help improve the speed of delivery. Please file a report at firebase.google.com/support identifying the network and devices that you are seeing the delay, maybe there is something that can be done on the FCM side to improve the delivery latency.
Same here. iOS has no delay. Android/FCM is not reliable.
My team also observed this problem and some time the push isn't received into the client at all and no matter how many retries. Our project is VoIP so it's critical for us.
Please help to solve this problem, if you need more logs or any others info please let me know.
I am facing the same issue while sending web push notifications on desktop devices(in chrome). I understand that this could be an issue for mobile devices to save battery life, but why is it happening for desktop device?
@Roeisteinberg any changes with FCM reliability? I'm considering relaying on FCM to VoIP app as well...
@tomerpetel no improvements has been done since I informed to FCM. I am still facing the same problem in my active projects. FCM side also does not pay serious attention to such an important problem.
@ilyasdirin any other way to receive notifications in a reliable way? Can't use service as well since Oreo unless using startForegroundService... really frustrating.
@tomerpetel there are some paid push notification sdk's available which claims delayless notification but I haven't tried any of them so I can not offer you one.
Android fcm is not reliable for android specially for VoIP application. we are also looking for another SDK's
@habibqureshi I'd be happy if you'll share your other SDK pursuit results :) I'm working on a VoIP application and having the same issue.
Catapush is a great service , you can try it out
Facing same issue, is there a solution yet?
this is still happening in 2020. Why is this issue closed?