【发布时间】:2016-10-11 21:31:17
【问题描述】:
这是我的情况,我已连接到 Firebase 控制台上的 ApplicationA 项目来处理通知。但我也想从 ApplicationB 项目中收听数据库。
问题是我只能有一个google-services.json,我必须在其中一个或另一个之间进行选择,但不能两者都选。所以,我的问题是,我如何指定从另一个应用程序中收听来自google-services.json 的数据库。
自更新以来,项目链接由json内部处理。在更新之前,我可以粘贴我想收听的数据库的整个链接。
这是我目前收听某些数据库路径的方式:
FirebaseDatabase database = FirebaseDatabase.getInstance();
fireActionUpdate = database.getReference("org/" + nameId + "/action");
fireRuleResponse = database.getReference("org/" + nameId + "/notify");
以前:
fireActionUpdate = new Firebase("https://yellow.firebaseio.com/org/" + nameId + "/action");
fireRuleResponse = new Firebase("https://yellow.firebaseio.com/org/" + nameId + "/notify");
【问题讨论】:
-
你仍然可以执行相同的操作,我最近确实为应用程序使用了一个 DB 用于消息传递和 GCM 实现
-
@silverFox - 似乎是一个答案。 Jaythaking - 你试过了吗?
-
@silverFox 的回答有要点。看看我的回答:stackoverflow.com/questions/37634767/…
-
@FrankvanPuffelen 你的答案不起作用-_-,第一条评论是崩溃了,我只是不明白为什么会被接受
-
重新打开。问题是您有两个进程调用
FirebaseDatabase.getInstance(),并且它们正在互相干扰。 Searching for the error message 导致这个答案:stackoverflow.com/questions/37337080/…
标签: android firebase firebase-realtime-database firebase-cloud-messaging