从 Firebase 控制台发送静默推送通知 [英] Send silent push notification from Firebase console

查看:33
本文介绍了从 Firebase 控制台发送静默推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图证明我已经研究了一段时间的概念,其中涉及我的应用接收静默通知.我正在使用 Firebase 云消息传递,因为它比开发人员的原生 APN 开销更少.

Trying to prove a concept I've been working on for a while, which involves my app recieving a silent notification. I am using Firebase Cloud Messaging as it has less overhead than native APNs for the developer.

我知道当您在自己的后端自己构建有效负载时,FCM 支持静默通知,这当然是我的意图.但是,我想确保我可以用这个通知做我想做的事情,因此想在我花时间编写后端之前使用 FCM 控制台来证明它.

I know FCM supports silent notifications when you build the payload yourself on your own backend, which is of course my intention. However, I want to make sure I can do what I want to do with this notification, and therefore want to prove it using the FCM console before I spend time writing my backend.

我已经设法从这里发送标准通知,但不是静默通知.即使我包含 content-available 标志,我仍然会收到警报.我认为这是由于 FCM 总是在 JSON 中包含 alert 参数.有没有办法在测试控制台中禁用它?

I have managed to send standard notifications from here, but not silent ones. Even when I include the content-available flag I'm still alerted. I think this is due to FCM always including the alert parameter in the JSON. Is there a way to disable this in the test console?

非常感谢,

推荐答案

无法从 Firebase 控制台发送不同于标准类型的通知.

There is no way to send notifications different from the standard kind from the Firebase Console.

一个相当方便的方法是使用 Postman 或 curl 设置授权标题.

A quite convenient way is to use Postman or curl with a set Authorization Header.

curl -H "Content-type: application/json" -H "Authorization:key=<YOUR-API-KEY>"  -X POST -d '{ "data": { "foo": "1","bar": "2"},"to" : "<YOUR-DEVICE-TOKEN>"}' https://fcm.googleapis.com/fcm/send

这篇关于从 Firebase 控制台发送静默推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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