且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-01-01 16:30:16

在 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.