Firebase Cloud Messaging send click_action [duplicate]

↘锁芯ラ 提交于 2019-12-17 05:16:13

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/44664911/firebase-cloud-messaging-send-click-action

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!