触发少数高优先级通知后的 Firebase 推送通知延迟 [英] Firebase push notification delay after triggering few high priority notifications

查看:84
本文介绍了触发少数高优先级通知后的 Firebase 推送通知延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Firebase 高优先级推送通知在 Android 设备中触发恐慌警报.对于最初的几次推送尝试,推送通知会立即到达并且效果很好.但是当我在一定时间后不断触发推送通知时,延迟会不断增加.

I use Firebase high priority push notifications to trigger Panic alarms in Android devices. For first few tries of push, immediately push notifications arrives and it works great. But when i keep triggering push notifications after certain amount of time slowly delay keeps increasing.

我希望它立即触发,因为这是恐慌情况.

I want it to trigger immediately as it is Panic situation.

我也关注了文档,内容如下:

I also followed the documentation which read:

高优先级:FCM 尝试立即传递高优先级消息,允许 FCM 服务在必要时唤醒休眠设备并运行一些有限的处理(包括非常有限的网络访问).高优先级消息通常会导致用户与您的应用或其通知进行交互.如果 FCM 检测到他们没有检测到的模式,您的消息可能会被取消优先级.Android P 引入了应用待机存储桶,它限制了您可以发送到应用的 FCM 高优先级消息的数量,这些消息不会导致用户使用您的应用或查看通知.如果在响应高优先级消息时以用户可见的方式显示通知,则该消息将不会消耗您的应用备用存储桶配额.

High priority: FCM attempts to deliver high priority messages immediately, allowing the FCM service to wake a sleeping device when necessary and to run some limited processing (including very limited network access). High priority messages generally should result in user interaction with your app or its notifications. If FCM detects a pattern in which they don't, your messages may be de-prioritized. Android P introduced app standby buckets which limit the number of FCM high priority messages you can send to your app that don't result in the user using your app or viewing a notification. If, in response to a high priority message, a notification is displayed in a way that is visible to the user, then your app standby bucket quota will not be consumed by that message.

由于一小部分 Android 移动用户使用的是高延迟网络,因此请避免在显示通知之前打开与服务器的连接.在允许的处理时间结束之前回调服务器可能对高延迟网络上的用户有风险.相反,将通知内容包含在 FCM 消息中并立即显示.如果您需要在 Android 上同步其他应用内内容,您可以安排 FJD 作业或 JobIntentService 在后台处理.

Because a small portion of the Android mobile population are on high latency networks, avoid opening a connection to your servers before displaying a notification. Calling back to the server before the end of the allowed processing time may be risky for users on high latency networks. Instead, include the notification content in the FCM message and display it immediately. If you need to sync for additional in-app content on Android, you can schedule an FJD job or a JobIntentService to handle that in the background.

如何确保尽快触发高优先级消息?在所有情况下都可能在一分钟内.

How can I make sure high priority messages are triggered as soon as possible? May be within a minute in all cases.

推荐答案

FCM 尝试立即传递高优先级消息,允许 FCM 服务在必要时唤醒休眠设备并运行一些有限的处理(包括非常有限的网络访问).高优先级消息通常会导致用户与您的应用或其通知进行交互.如果 FCM 检测到模式(例如测试模式),则您的消息可能会被取消优先级.Android P 引入了应用待机存储桶,它限制了您可以发送到应用的 FCM 高优先级消息的数量,这些消息不会导致用户使用您的应用或查看通知.如果在响应高优先级消息时以用户可见的方式显示通知,则该消息将不会消耗您的应用备用存储桶配额.

FCM attempts to deliver high priority messages immediately, allowing the FCM service to wake a sleeping device when necessary and to run some limited processing (including very limited network access). High priority messages generally should result in user interaction with your app or its notifications. If FCM detects a pattern (such as testing pattern) then your messages may be de-prioritized. Android P introduced app standby buckets which limit the number of FCM high priority messages you can send to your app that don't result in the user using your app or viewing a notification. If, in response to a high priority message, a notification is displayed in a way that is visible to the user, then your app standby bucket quota will not be consumed by that message.

这篇关于触发少数高优先级通知后的 Firebase 推送通知延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆