Firebase消息传递-什么是"content_available" : 真的 [英] Firebase messaging - whats "content_available" : true

查看:288
本文介绍了Firebase消息传递-什么是"content_available" : 真的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了许多像

{ 
  "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有效负载中的内容可用.发送通知或消息并将其设置为true时,将唤醒不活动的客户端应用程序,并且消息通过APN作为静默通知而不是通过FCM连接服务器通过APN发送.请注意,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" : 真的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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