iOS 的 FCM 富推送通知负载
FCM rich push notification payload for iOS
我正在为我的项目使用 FCM
。它有一个类型的丰富推送通知。我尝试修改大多数可能的方式来从 FCM
获取推送。我从 FCM
那里得到了普通的推送,而不是图像。
我也在使用 push try 检查与 APNS 相同的编码。我得到了预期的推送通知设计。
这是我的 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
}
}
我也是需要的类别more details about payload in FCM
我是否遗漏了 fire-base 控制台中的任何设置或有效负载中的设置。
您的 FCM 负载中的 mutable-content
和 content-available
不正确。它的格式应为 mutable_content
和 content_available
。两者都是 boolean 并且还必须在 notification
参数之外。像这样:
{
"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
:
The action associated with a user click on the notification.
Corresponds to category in the APNs payload.
这对我有用。接受的答案似乎有一些不必要的信息。
{
"to" : "devicekey OR /topics/sometopic",
"mutable_content": true,
"data": {
"mymediavideo": "https://myserver.com/myvideo.mp4"
},
"notification": {
"title": "my title",
"subtitle": "my subtitle",
"body": "some body"
}
}
我正在为我的项目使用 FCM
。它有一个类型的丰富推送通知。我尝试修改大多数可能的方式来从 FCM
获取推送。我从 FCM
那里得到了普通的推送,而不是图像。
我也在使用 push try 检查与 APNS 相同的编码。我得到了预期的推送通知设计。
这是我的 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
}
}
我也是需要的类别more details about payload in FCM
我是否遗漏了 fire-base 控制台中的任何设置或有效负载中的设置。
您的 FCM 负载中的 mutable-content
和 content-available
不正确。它的格式应为 mutable_content
和 content_available
。两者都是 boolean 并且还必须在 notification
参数之外。像这样:
{
"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
:
The action associated with a user click on the notification.
Corresponds to category in the APNs payload.
这对我有用。接受的答案似乎有一些不必要的信息。
{
"to" : "devicekey OR /topics/sometopic",
"mutable_content": true,
"data": {
"mymediavideo": "https://myserver.com/myvideo.mp4"
},
"notification": {
"title": "my title",
"subtitle": "my subtitle",
"body": "some body"
}
}