FCM链接在桌面通知中不起作用 [英] FCM link not working in desktop notification
本文介绍了FCM链接在桌面通知中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们正尝试通过php服务发送调用FCM rest api的桌面通知.
We are trying to send a desktop notification calling the FCM rest api via a php service.
我们调用https://fcm.googleapis.com/fcm/send
服务,并传递以下有效负载:
We call the https://fcm.googleapis.com/fcm/send
service, passing the following payload:
"data" => [
"notification" => [
"title" => $content->title,
"body" => "notification body",
"icon" => url('assets/images/logo_3.png'),
],
"webpush" => [
"headers" => [
"Urgency" => "high",
],
"fcm_options" => [
"link" => url($content->url)
]
],
],
该通知是在桌面设备上收到的(在Windows 10上进行了测试),但是当我们单击弹出窗口时,该链接未在浏览器中打开.
The notification is received in desktop (tested on windows 10) but when we click on the popup the link is not opened in the browser.
我们在做什么错了?
推荐答案
原来,我们必须使用click_action
字段,如下所示:
It turns out that we must use click_action
field, like this:
"notification" => [
"title" => $content->title,
"body" => "body",
"icon" => "assets/icon.png",
"click_action" => "https://www.example.com",
]
此处的文档: https://firebase.google.com/docs/cloud-messaging/http-server-ref
这篇关于FCM链接在桌面通知中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文