我看到了很多类似的 firebase push 例子
I saw many examples of firebase push like
{
"to" : "egu9jGiMcew:APA91bFv2Rewdz.....KZZmEURvbq-aA2",
"data": {
"id": 19,
"title": "Title test",
"msg": "Text of the test",
"code": 2,
"infosUrl": "ttp://www.secondguide.tours",
"longitude": 5.5,
"latitude": 44.5,
"eventLocation": "nowhere",
"startDate": "24/07/2016",
"endDate": "25/07/2016",
},
"delay_while_idle" : false,
"priority" : "high",
"content_available" : true
}
我没有得到目的
"delay_while_idle" : false,
"priority" : "high",
"content_available" : true
在这,有人可以解释一下吗?
in this, can somebody explain?
如果您检查了 官方文档 首先,你会看到相应的描述:
If you checked the official documentation first, you'd see the corresponding description:
content_available
- 在 iOS 上,使用此字段表示 APNs 负载中的 content-available.当发送通知或消息并将其设置为 true 时,将唤醒非活动客户端应用程序,并通过 APNs 作为静默通知发送消息,而不是通过 FCM 连接服务器.请注意,APN 中的静默通知不保证会传递,并且可能取决于用户打开低功耗模式、强制退出应用程序等因素.在 Android 上,默认情况下数据消息会唤醒应用程序.在 Chrome 上,目前不支持.
content_available
- On iOS, use this field to represent content-available in the APNs payload. When a notification or message is sent and this is set to true, an inactive client app is awoken, and the message is sent through APNs as a silent notification and not through the FCM connection server. Note that silent notifications in APNs are not guaranteed to be delivered, and can depend on factors such as the user turning on Low Power Mode, force quitting the app, etc. On Android, data messages wake the app by default. On Chrome, currently not supported.
您帖子的标题只是询问 content_available
,而只是为了涵盖另外两个,priority
(也来自文档):
The title of your post is only asking about content_available
, but just to cover the other two, priority
(also from the docs):
设置消息的优先级.有效值是正常的";和高".在 iOS 上,这些对应于 APN 优先级 5 和 10.
Sets the priority of the message. Valid values are "normal" and "high." On iOS, these correspond to APNs priorities 5 and 10.
默认情况下,通知消息以高优先级发送,数据消息以正常优先级发送.正常优先级可优化客户端应用程序的电池消耗,除非需要立即交付,否则应使用此优先级.对于具有正常优先级的消息,应用可能会以未指定的延迟接收消息.
By default, notification messages are sent with high priority, and data messages are sent with normal priority. Normal priority optimizes the client app's battery consumption and should be used unless immediate delivery is required. For messages with normal priority, the app may receive the message with unspecified delay.
当消息被高优先级发送时,立即发送,并且应用可以显示通知.
When a message is sent with high priority, it is sent immediately, and the app can display a notification.
delay_while_idle
早就被弃用了,所以我不会费心提供它的行为.
delay_while_idle
has long since been deprecated so I wouldn't bother providing it's behavior.
这篇关于Firebase 消息传递 - 什么是“content_available": 真的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!