FCM将消息发送到特定应用程序中的主题 [英] FCM send messages to topic in specific app

查看:53
本文介绍了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.

有人知道如何解决这个问题吗?

does anyone know how to solve this?

推荐答案

您无法阻止消息同时进入这两个应用程序.但是,您可以做的是在消息中添加一些内容,以表明要使用的应用程序.然后,该应用可以选择忽略不应处理的消息.

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将消息发送到特定应用程序中的主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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