5 ms·
This has been coming for a while. We attempted to create a push-based notification system based on MQTT. It worked well, then the notifications started getting
by ddrager 7y ago
This has been coming for a while. We attempted to create a push-based notification system based on MQTT. It worked well, then the notifications started getting lost. Turns out, the receiver service was getting killed in the background. We found out the best way to get reliable notification was through Google's own GCM (which has now moved to Firebase Cloud Messaging.
We learned its incredibly difficult, if not impossible to build an app (with reliable notifications) that do not use Google services.
You can say its in an effort to maximize battery resources, which I totally understand, but by requiring a Google service (and now library) you are truly tied in to and reliant on their systems.
BTW, as others have pointed out, there are open source Firebase libraries (https://firebaseopensource.com/projects/firebase/firebase-android-sdk/ https://firebaseopensource.com/projects/firebase/firebase-an...)
- bchimp 7y agoThis has been true for awhile once they forced apps to use API26 or higher (if you want to be listed in the Play store, and really, there is no other place if you want decent exposure.) I had a similar experience switching from "real background" to using FCM. I understand the battery saving motivation, but the problem is that the performance of the google service is terrible. The response time of my simple notification system was nearly instantaneous, but OK google, I'll play your game. I put together something that used FCM and it can take 15 or 20 MINUTES to get even a "high priority" message from FCM. Reading the google docs, apparently google will deprioritize notifications that are shown but "not intereacted with" in a timely manner, so that is another source of delay. I think the crux of the matter is that notifications have multiple purposes: signaling, and advertising, etc. Google hasn't provided a way for an app to declare its use case. So, you get policies to prevent notification spam creeping in and messing with basic app signaling functionality. In the end, I kept both my "in-house" notifications for use by older Androids, and a kluge that uses FCM in addition, with some hacks to get somewhat better FCM performance. I live with the notification in Oreo+ and just tell users to ignore it (but honestly, I don't think users care that much.)
- antpls 7y ago> I put together something that used FCM and it can take 15 or 20 MINUTES to get even a "high priority" message from FCM. (from what I remember of some android documentations) Your definition of "high priority" is different from Google's one, which is also different from the end-user's definition. Google probably favors the end-user's preferences more than the developer's preferences. If the user wants all notifications asap from a particular app, the system will do a best effort to deliver, given all the other apps notifications and the current battery level.
- jayd16 7y ago>The response time of my simple notification system was nearly instantaneous, but OK google, I'll play your game. I put together something that used FCM and it can take 15 or 20 MINUTES to get even a "high priority" message from FCM. Letting your phone actually sleep is the battery saving feature. Also, you get throttled for high volume so check that as well. If you think your messages are so important to have a constant socket open then make a foreground service. You're abusing a system that is really not suited to your needs.
- ajnin 7y agoSome types of messages do require immediate attention of the user, or are of highest value if delivered immediately. Instant messaging apps have been using notifications for a long time and did not require a foreground service. Expecting instant delivery of that class of messages is not abusing the system.
- jayd16 7y agoWhile it's not really possible to do this in your own background service any more, GCM still supports this use case. This is the deprioritization the grand parent is talking about. If there's already a notification showing you won't get instant follow up responses. It's a compromise to be sure but if you want to break that compromise you have to make a foreground service.
- 7y ago
- HillaryBriss 7y ago> there are open source libraries Thanks for the link, but IDK. I don't see FCM in that collection. What am I misunderstanding here?
- anotherwebdev 7y agoHave you tried using VAPID? I didn't want to use firebase and the pwa app I made uses VAPID instead and push notifications show fine. Couldn't that be used in native push notifications, too? https://developers.google.com/web/updates/2016/07/web-push-interop-wins https://developers.google.com/web/updates/2016/07/web-push-i...
- barrkel 7y agoAre Google push notifications reliable? They certainly don't work reliably for Gmail, I frequently don't find out about emails unti I open the app.