iOS离线时的FCM行为 [英] FCM behavior when offline for iOS

查看:90
本文介绍了iOS离线时的FCM行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我向离线的iOS设备发送通知时(例如处于飞行模式或关闭状态),我无法弄清楚FCM的行为.

I'm having trouble figuring out how FCM behaves when I send a notification to an iOS device that is offline (e.g. in airplane mode, or turned off).

time_to_live 属性的文档中提到Currently, time_to_live is not supported for notification messages on iOS.,但没有提供替代方法的说明.我已经尝试过测试,无论我将time_to_live属性设置为什么,似乎推送通知有时都会通过,有时却不会,尽管我不确定这是否是由于节流或其他原因引起的发生在FCM方面.

The documentation on the time_to_live property mentions that Currently, time_to_live is not supported for notification messages on iOS. but doesn't provide an explanation of what is done instead. I've tried testing it, and it seems like a push notification sometimes goes through, and sometimes does not, regardless of what I set the time_to_live property to be, although I'm not sure if that's due to throttling or something else happening on the FCM side.

相关地,虽然文档没有明确提及它不适用于iOS,但似乎无法使delay_while_idle属性在iOS上正常工作-手机处于睡眠状态时发送的通知仍会唤醒电话,即使我将delay_while_idle设置为true.

Relatedly, I can't seem to get the delay_while_idle property to work on iOS, although the documentation does not explicitly mention that it isn't available for iOS - notifications that are sent while the phone is asleep still wake the phone, even if I set delay_while_idle to be true.

有人对这应该如何工作有任何见识吗?

Does anyone have any insight into how this is supposed to work?

推荐答案

time_to_live是适用于Android和iOS的AFAIK.但是,由于将消息发送到FCM的iOS设备的过程是这样的:

The time_to_live is AFAIK applicable to both Android and iOS. However, since the process of sending the message to iOS devices for FCM goes like this:

应用程序服务器> FCM服务器> APN> iOS设备

App Server > FCM Server > APNs > iOS device

可以肯定地说,只有FCM Server才使用time_to_live,具体取决于

It is safe to say that only the FCM Server makes use of the time_to_live, as per it's description:

此参数指定如果设备处于脱机状态,则消息应保留在FCM存储中的时间(以秒为单位).支持的最长生存时间为4周,默认值为4周.有关更多信息,请参阅设置消息的寿命.

环顾四周,发送到离线设备时APN的行为是(来自

Looking around, the behavior for APNs when sending to offline devices is (from the Apple docs):

Apple Push Notification服务包括执行存储转发功能的服务质量(QoS)组件.如果APNs尝试传递通知,并且目标设备处于脱机状态,则APNs将在有限的时间内存储该通知,并在该设备再次变得可用时将其传递.该组件仅存储每个设备和每个应用程序的最新通知.如果设备处于脱机状态,则发送针对该设备的通知请求会导致先前的请求被丢弃.如果设备长时间保持离线状态,则其在APN中存储的所有通知都将被丢弃.

Apple Push Notification service includes a Quality of Service (QoS) component that performs a store-and-forward function. If APNs attempts to deliver a notification and the destination device is offline, APNs stores the notification for a limited period of time and delivers it when the device becomes available again. This component stores only the most recent notification per device and per app. If a device is offline, sending a notification request targeting that device causes the previous request to be discarded. If a device remains offline for a long time, all its stored notifications in APNs are discarded.

到目前为止, delay_while_idle 现在不推荐使用.

As of now, delay_while_idle is now deprecated.

我知道您可以唤醒 iOS手机(在线/连接到体面的网络)的方法是简单地

The way I know that you could do to wake up an iOS phone (online/connected to a decent network) is to simply set the priority to high.

这篇关于iOS离线时的FCM行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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