Mat*_*san 11 push-notification apple-push-notifications ios firebase firebase-cloud-messaging
我正在使用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"
}
Run Code Online (Sandbox Code Playgroud)
这里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
}
}
Run Code Online (Sandbox Code Playgroud)
另外,我需要更多关于FCM中有效载荷的详细信息
我错过了基本控制台中的任何设置,还是来自有效负载的设置.
AL.*_*AL. 32
在mutable-content
和content-available
你的FCM有效载荷不正确.它应格式化为mutable_content
和content_available
.两者都是布尔值,也必须在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"
}
}
Run Code Online (Sandbox Code Playgroud)
对于category
FCM 的对应部分,您应该使用click_action
:
与用户点击通知相关联的操作.
对应于APNs有效载荷中的类别.
这对我有用。接受的答案似乎有一些不必要的信息。
{
"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"
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
20395 次 |
最近记录: |