【发布时间】:2017-02-06 08:52:27
【问题描述】:
参考:https://github.com/firebase/quickstart-js/tree/master/messaging
我已经添加了键值对:
"requireInteraction": true
但桌面 Chrome 中的通知在 20 秒后仍然消失。有谁知道 Firebase 是否支持这个键值对?谢谢!
我的例子如下。请将[...] 更改为您的。
curl -X POST -H "Authorization: key=[...]" -H "Content-Type: application/json" -d '{
"notification": {
"requireInteraction": true,
"title": "This is custom title",
"body": "this is custom body",
"click_action": "https://google.com",
"data" : {"requireInteraction": true }
},
"to": "[...]",
}' "https://fcm.googleapis.com/fcm/send"
【问题讨论】:
-
嗨塞缪尔。我不认为
requireInteraction是你应该在你的有效载荷中设置的东西。它应该只在您 构建 通知时声明。如果问题只是被支持,那么requireInteraction不属于notification有效负载,但可以存在 在data有效负载中。 :) -
@AL。我尝试在 data payload 或 notification payload 中添加 requireInteraction: true ,但我的 chrome 桌面中的通知弹出窗口在 20 秒后仍然消失
-
以下演示中的弹出窗口之一在用户单击之前不会关闭。 googlechrome.github.io/samples/notifications/…
标签: javascript google-chrome firebase push-notification firebase-cloud-messaging