适用于iOS的FCM丰富推送通知负载 [英] FCM rich push notification payload for iOS
问题描述
我正在为我的项目使用 FCM
。它有一个类型的丰富推送通知。我尝试修改大多数可能的方法来从 FCM
中获取。我从 FCM
获得了普通的推动,而不是图像。
I am using FCM
for my project. It's have rich push notification for a type. I tried to modified most of possible ways to get push from FCM
. I got obly ordinary push from FCM
, not with image.
我也用APNS检查相同的编码使用< a href =http://pushtry.com/ =noreferrer> push try 。我得到了推送通知的预期设计。
I am also check with APNS same coding using push try. I got what expected design for push notification.
这里我的 APNS
有效载荷
{
"aps": {
"alert": "Enter your message",
"badge": 1,
"sound": "default",
"content-available": 1,
"mutable-content": 1
},
"mediaUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/FloorGoban.JPG/1024px-FloorGoban.JPG"
}
这里 FCM
有效载荷
{
"to": "dWB537Nz1GA:APA91bHIjJ5....",
"data":
{
"message": "Offer!",
"mediaUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/FloorGoban.JPG/1024px-FloorGoban.JPG"
},
"notification":
{
"body": "Enter your message",
"sound": "default",
"content-available": 1,
"mutable-content": 1
}
}
我也是eed类别有关FCM中有效负载的更多详细信息
我错过了基本控制台中的任何设置,或者是来自有效负载的设置。
Am I missing any setting in fire-base console or is that from payload.
推荐答案
FCM有效负载中的 mutable-content
和 content-available
不正确。它的格式应为 mutable_content
和 content_available
。两者都是 boolean ,并且还必须在通知
参数之外。像这样:
The mutable-content
and content-available
in your FCM payload is incorrect. It should be formatted as mutable_content
and content_available
. Both are boolean and must also be outside the notification
parameter. Like so:
{
"to": "dWB537Nz1GA:APA91bHIjJ5....",
"content_available": true,
"mutable_content": true,
"data":
{
"message": "Offer!",
"mediaUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/FloorGoban.JPG/1024px-FloorGoban.JPG"
},
"notification":
{
"body": "Enter your message",
"sound": "default"
}
}
对于FCM中类别
的对应项,您应该使用 click_action
:
For the counterpart of category
in FCM, you should use click_action
:
与用户点击通知相关联的操作。
The action associated with a user click on the notification.
对应类别在APNs有效载荷中。
Corresponds to category in the APNs payload.
这篇关于适用于iOS的FCM丰富推送通知负载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!