FCM 向特定应用中的主题发送消息

FCM send messages to topic in specific app(FCM 向特定应用中的主题发送消息)

本文介绍了FCM 向特定应用中的主题发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个 Android 应用在 firebase 基础架构中共享同一个项目

I've two android apps that share same project in firebase infrastructure

当我准备 firebase 基础设施以运行第二个应用程序时,我决定在与第一个应用程序相同的 firebase 项目中创建第二个应用程序......这是一个基本的决定,因为我讨厌 firebase 项目之间的切换"工具.

When i was preparing the firebase infrastructue to run the second one i decided for creating a second app in the same firebase project as the first one... this was a decision made basically because i hated the firebase "switch between projects" tools.

这两个应用程序作为同一个项目托管了一年多,尽管不共享实际资源,但运行良好
但是现在我遇到了问题

both apps ran great for over a year being hosted as same project although not sharing real resources
BUT NOW I RUN INTO A PROBLEM

我将 FCM 添加到应用程序中,但我找不到向特定应用程序中的主题发送消息的方法...
firebase 让我只能在向特定应用程序或特定主题发送消息之间进行选择...这两个应用程序具有相同的主题名称,现在如果任何用户在手机上都安装了这两个应用程序,我无法想象当我向用户订阅了两个不同应用程序的主题发送通知时,firebase 会如何表现.

I added FCM into the apps and i cant find a way to send messages to topics in a specific app...
firebase let me only choose between send message to specific app or specific topic... both apps have same topics names and now if any user has both of them installed at the phone i cant imagine how firebase will behave when i send a notification to a topic the user has two different apps subscribed to.

有人知道怎么解决吗?

推荐答案

您无法阻止消息发送到两个应用程序.但是您可以做的是在消息中添加一些内容来说明它打算去哪个应用程序.然后应用可以选择忽略它不应该处理的消息.

You can't stop the message from going to both apps. But what you can do is put something in the message to say which app it was intended to go to. The app can then choose to ignore messages it's not supposed to handle.

这篇关于FCM 向特定应用中的主题发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:FCM 向特定应用中的主题发送消息

基础教程推荐