适用于iOS的FCM丰富推送通知负载
我正在为我的项目使用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 } }
另外,我需要更多关于FCM中有效载荷的详细信息
我错过了基本控制台中的任何设置,或者是来自有效负载的设置。
FCM有效content-available
mutable-content
和content-available
不正确。 它应格式化为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" } }
对于FCM中的category
对应,您应该使用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" } }