如何将 Firebase 消息发送到项目中的特定应用程序?

How to send Firebase message to specific application in project?(如何将 Firebase 消息发送到项目中的特定应用程序?)
本文介绍了如何将 Firebase 消息发送到项目中的特定应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 firebase 有疑问.它允许为单个项目添加多个应用程序.我添加了 App1、App2 和 App3.如何单独向 App1 发送通知?这 3 个应用的服务器密钥是相同的.

I have a doubt based on firebase. It allows to add multiple application for a single project. I have added App1, App2 and App3. How can I send a notification to App1 alone? Server key is the same for those 3 apps.

推荐答案

在 Firebase 控制台的通知面板中,您可以向特定应用发送通知消息.但 Firebase Cloud Messaging API 不支持此类定位.

In the Notifications panel in the Firebase Console, you can send a notification message to a specific app. But there is no support for such targeting in the Firebase Cloud Messaging API.

不过,您可以通过为每个应用定义特定属性来轻松模拟该行为:/topics/apps-app1/topics/apps-app2、等等.然后让每个应用订阅自己的主题并且您可以使用单个 FCM 服务器密钥来定位每个应用的用户.

You can easily emulate the behavior though, by defining a specific property for each of your apps: /topics/apps-app1, /topics/apps-app2, etc. Then have each app subscribe to its own topic and you can target the users of each app with a single FCM server key.

这篇关于如何将 Firebase 消息发送到项目中的特定应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

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

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)