Firebase Cloud Messaging发送click_action [英] Firebase Cloud Messaging send click_action

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

问题描述

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

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

解决方案

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

您必须在自己的App Server上构建有效负载,或使用Postman(

此处检索的

语法. >

上面指出的API_KEY指的是服务器密钥,可以在您的.

其中的部分:

"{\"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 Cloud Messaging发送click_action的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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