问题描述
我正在为我的项目使用 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.
我还使用 push try 检查 APNS 相同的编码.我得到了预期的推送通知设计.
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
payload
{
"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
}
}
我还需要类别 更多详细信息FCM 中的有效载荷
我是否遗漏了 fire-base 控制台中的任何设置,或者是有效载荷中的设置.
Am I missing any setting in fire-base console or is that from payload.
推荐答案
您的 FCM 负载中的 mutable-content
和 content-available
不正确.它应该被格式化为 mutable_content
和 content_available
.两者都是 boolean 并且还必须在 notification
参数之外.像这样:
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 中 category
的对应物,您应该使用 click_action
:
For the counterpart of category
in FCM, you should use click_action
:
与用户点击通知相关的操作.
对应于 APNs 负载中的 category.
Corresponds to category in the APNs payload.
这篇关于适用于 iOS 的 FCM 丰富的推送通知负载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!