I have 2 applications(different package names) catering to 2 different user groups. One puts data into database and the other retrieves it. Therefore I want only 1 firebase database for both the apps. Firebase allows only 1 database for 1 package name as far as I know. Is there a way to solve this problem and have 1 Firebase database for 2 apps?
Yes, it is! a single firebase database can be access by multiple app.. provided each of your apps use the same authentication details.
A Firebase project can have one or more Firebase Apps registered to it (for example, both the iOS and Android versions of an app, or both the free and paid versions of an app).
You can set up one or more Firebase Hosting sites in a single Firebase project. Since the sites are all in the same Firebase project, all the sites can access the other Firebase resources of the project. Each site has its own hosting configuration. Each site hosts its own collection of content.
Create multiple Realtime Database instancesIn the Firebase console, go to the Data tab in the Develop > Database section. Select Create new database from the menu in the Realtime Database section. Customize your Database reference and Security rules, then click Got it.
Yes this is possible using the Firebase console. You only get one database per project but you can have many apps per project just by adding them in the console. They don't need to have the same package name or signing key.
If you have some reason why you can't add them both to the same project, you will have to configure at least one of the apps manually in client side code. So rather than using the google-services.json
file for configuration, you can call FirebaseApp.initializeApp()
manually and fill in the information so both apps are talking to the same Firebase project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With