10
votes

I'm sending push messages to small group of devices (less than 5) subscribed to one topic with priority parameter set to high

High priority. FCM attempts to deliver high priority messages immediately, allowing the FCM service to wake a sleeping device when possible and open a network connection to your app server. Apps with instant messaging, chat, or voice call alerts, for example, generally need to open a network connection and make sure FCM delivers the message to the device without delay. Set high priority only if the message is time-critical and requires the user's immediate interaction, but beware that setting your messages to high priority contributes more to battery drain compared with normal priority messages.

But when I put device to IDLE state it comes with big delay. On Nougat 7.1 delay is more than 10 mins. This type of push requires delay less than 10 secs.

Setting time_to_live to 0 solves issues only on Marshmallow. Nougat still failing.

So, I see only 3 possible causes of issue

  1. Messages sent to topic can't be high priority. But sending independent messages to each device will increase app-server load. I need to load fresh token from Firebase Database, so the result will be - 10 http requests for 5 users instead of 1.

  2. App must be in whitelist. But according to docs it's not acceptable, if I'm using FCM. And I don't want it, because it will cause battery drain.

  3. Bug? https://github.com/firebase/quickstart-android/issues/100

If real cause is first, then why it isn't described in documentation?

2
Is your delay_while_idle set to false?AL.
@AL delay_while_idle not set at all, default values is false. Also it will be deprecated tomorrowDima Rostopira
Did you figure it out? Also is there a limit on high priority topic messages?Kushan
@Kushan I was tired of this and moved to OneSignal. It has device-to-device push, so I don't need server. Devices just getting all required push ids from Firebase DB and send push to themDima Rostopira
@Pro because nobody knows, except people from Google, but looks like they don't careDima Rostopira

2 Answers

2
votes

Issue solved by setting time_to_live to 0. According to docs, this set's priority to "now or never"

Another advantage of specifying the lifespan of a message is that FCM never throttles messages with a time_to_live (TTL) value of 0 seconds. In other words, FCM guarantees best effort for messages that must be delivered "now or never." Keep in mind that a time_to_live value of 0 means messages that can't be delivered immediately are discarded. However, because such messages are never stored, this provides the best latency for sending notification messages.

UPD: solved only for Marshmallow. On Nougat is still an issue.

UPD2: just don't use topics, they aren't intended for sending pushes without delay.

0
votes

According to the Firebase Documentation:

Topic messages are optimized for throughput rather than latency. For fast, secure delivery to single devices or small groups of devices, target messages to registration tokens, not topics.