从 Firebase 控制台发送静默推送通知

Send silent push notification from Firebase console(从 Firebase 控制台发送静默推送通知)
本文介绍了从 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 控制台发送静默推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Why local notification is not firing for UNCalendarNotificationTrigger(为什么没有为UNCalendarNotificationTrigger触发本地通知)
iOS VoiceOver functionality changes with Bundle Identifier(IOS画外音功能随捆绑包标识符而变化)
tabbar middle tab out of tabbar corner(选项卡栏中间的选项卡角外)
Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
Dropbox Files.download does not start when number of files in folder is gt; 1000(当文件夹中的文件数为1000时,Dropbox Files.Download不会启动)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)