I am currently trying to add a second firebase Real Time Database to my application. I am following this tutorial from the Firebase blog which is exactly what I want. I am currently connected to the other Database. However I am unable to create a reference
eg: mRef = FirebaseDatabase.getInstance().getReference();
I am unsure of how to intialise the new database to utilise the information inside.
mRef = FirebaseDatabase.getInstance().getReference();
Intent intent = getIntent();
FirebaseOptions options = new FirebaseOptions.Builder()
.setApplicationId("AppID") // Required for Analytics.
.setApiKey("APIKEY") // Required for Auth.
.setDatabaseUrl("DatabaseURL") // Required for RTDB.
.build();
FirebaseApp.initializeApp(this, options, "secondary");
// Retrieve my other app.
FirebaseApp app = FirebaseApp.getInstance("secondary");
// Get the database for the other app.
FirebaseDatabase secondaryDatabase = FirebaseDatabase.getInstance(app);
I have tried and I'm able to obtain the URL of the new database by using app.getOptions.getDatabaseURL, but I'm not able to use it to access information in the new Database.
I've also read through the Firebase docs on android but I can't seem to find anything that works!
Any help would be greatly appreciated!!! Thanks :)