Reputation: 487
You can access the Firebase project from multiple Android apps, but, if my intent is to be able to access multiple projects within the same Android app?
For example, 3 projects hosted each on their own proprietary accounts and a common Android app that can access them all.
Thanks in advance for any answer!
Upvotes: 1
Views: 798
Reputation: 1466
You have to initialize multiple FirebaseApp
instances yourself(this is done by google services plugin by reading google-services.json)
//This builder may call more functions depending on features being used
val secondProjectOptions = FirebaseOptions.Builder()
.setApplicationId("app id")
.setApiKey("api key")
.build()
FirebaseApp.initializeApp(this, secondProjectOptions, "secondProject")
//Use this app instance to access various features such as db
val secondProjectApp = FirebaseApp.getInstance("secondProject")
Upvotes: 2