Firebase 云消息传递发送 click_action [英] Firebase Cloud Messaging send click_action

查看:51
本文介绍了Firebase 云消息传递发送 click_action的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道一种从 Firebase 控制台发送 click_action 的方法吗?

我只想发送 click_action 按钮以使用通知,即使应用程序已关闭或在后台.

解决方案

在使用 Firebase 通知控制台发送消息时,目前无法设置 click_action 参数.

您必须在自己的应用服务器上构建有效负载,或使用 Postman (此处的说明)或cURL(以下说明).

<小时><小时>

通过 cURL 发送下游消息

您可以通过 cURL 发送请求来测试使用 FCM REST API 发送消息.

curl --header "授权:key="--header 内容类型:"application/json" https://fcm.googleapis.com/fcm/send -d "{"registration_ids":["ABC"]}"

此处检索的语法.

上面指出的 API_KEY 指的是可以在您的 Firebase 控制台的云消息传递选项卡.

其中的部分:

"{"registration_ids":["ABC"]}"

是,可以替换为您自己的有效负载.如需了解详情,请参阅FCM HTTP 协议文档.>

Someone know one way to send the click_action from the firebase console ?

I just want to send the click_action button to use the notification even if the app is closed or in background.

解决方案

There is currently no way to set the click_action parameter when using the Firebase Notifications console to send the message.

You'll have to build the payload on your own App Server, or use Postman (instructions here) or cURL (instructions below) when testing.



Sending Downstream Messages via cURL

You can test sending messages using the FCM REST API by sending a request through cURL.

curl --header "Authorization: key=<API_KEY>" 
       --header Content-Type:"application/json" 
       https://fcm.googleapis.com/fcm/send 
       -d "{"registration_ids":["ABC"]}"

Syntax retrieved from here.

The API_KEY indicated above is referring to the Server Key that can be seen in your Firebase Console's Cloud Messaging Tab.

The part where:

"{"registration_ids":["ABC"]}"

is, can be replaced with your own payload. See the FCM HTTP Protocol Documentation for more details.

这篇关于Firebase 云消息传递发送 click_action的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆