【发布时间】:2020-02-24 10:32:19
【问题描述】:
目前,我正在 Angular 中启动 PWA。当我单击通知时,我需要拦截一些推送通知并重定向到此应用程序。我正在使用 Firebase 作为推送服务器。 今天,我可以收到推送通知,但是当我点击其中一个时,我没有被重定向。 我用 Postman 发送请求,我的 HTTP 请求是这样的:
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"
}
}
}
在我的网络应用程序中,我收到以下数据:
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: []
我想在数据部分重新找到我的网址。有人对此有想法吗?
【问题讨论】:
-
你是如何解决这个问题的?我有同样的问题
标签: firebase http push-notification firebase-cloud-messaging progressive-web-apps