如何连接两个单独的firebase数据库以读取其数据?

时间:2019-01-05 14:06:49

标签: java firebase-realtime-database

我的代码运行无任何错误,但无法读取其他应用数据库:

public void initialize() {
FirebaseOptions options = new FirebaseOptions.Builder()
                  .setApplicationId("1...5")//Required for analytics
                  .setApiKey("Al...yA")//Required for auth
                  .setDatabaseUrl("https://...firebaseio.com")
                  .build();
FirebaseApp.initializeApp(this,options,"project ID");
FirebaseApp secondApp = FirebaseApp.getInstance("project ID");
FirebaseDatabase firstDatabase = FirebaseDatabase.getInstance();
 FirebaseDatabase secondDatabase = FirebaseDatabase.getInstance(secondApp);
secondDatabase.getReference().setValue(ServerValue.TIMESTAMP);
 }

是否可以同时使用2 FirebaseDatabase? 我该怎么做?

0 个答案:

没有答案