Firebase PWA上推送通知中的重定向URL
目前,我在Angular开始一个PWA。当我点击通知时,我需要切换一些推送通知并重定向到此应用程序。我正在使用Firebase作为推送服务器。 今天,我可以收到推送通知,但当我点击其中一个时,我不会被重定向。 我用邮递员发送我的请求,我的HTTP请求如下:Firebase PWA上推送通知中的重定向URL,firebase,http,push-notification,firebase-cloud-messaging,progressive-web-apps,Firebase,Http,Push Notification,Firebase Cloud Messaging,Progressive Web Apps,目前,我在Angular开始一个PWA。当我点击通知时,我需要切换一些推送通知并重定向到此应用程序。我正在使用Firebase作为推送服务器。 今天,我可以收到推送通知,但当我点击其中一个时,我不会被重定向。 我用邮递员发送我的请求,我的HTTP请求如下: POST /fcm/send HTTP/1.1 Host: fcm.googleapis.com Authorization: key=XXXX Content-Type: application/json { "to":"XXXX",
POST /fcm/send HTTP/1.1
Host: fcm.googleapis.com
Authorization: key=XXXX
Content-Type: application/json
{
"to":"XXXX",
"content_available": true,
"notification": {
"title": "hello",
"body": "test message",
"data": {
"url": "http://myurl.com"
}
}
}
在我的web应用程序中,我收到以下数据:
data:
gcm.notification.content_available: "true"
gcm.notification.data: "{"url":"http:\/\/myurl.com"}"
extra: "juice"
from: "300398521917"
notification:
title: "hello"
body: "test message"
collapse_key: "do_not_collapse"
并且,当我单击接收通知时,我的应用程序会截获事件并记录:
action: ""
notification:
actions: []
badge: ""
body: "test message"
data: null
dir: "auto"
icon: ""
image: ""
lang: ""
renotify: false
requireInteraction: false
silent: false
tag: ""
timestamp: 1582539931548
title: "hello"
vibrate: []
我想在数据部分重新填充我的url。有人对此有想法吗?我试过下面的方法,它对我有用 { “收件人”:“XXXX”, “内容可用”:正确, “通知”:{ “标题”:“你好”, “正文”:“测试消息”, “单击操作”:https://example.com" }
}您是如何修复此问题的?我也有同样的问题