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?
Asked
Active
Viewed 1.1k times
22
-
Please check http://stackoverflow.com/a/34257325/2873538 – Ajeet Shah May 23 '16 at 11:51
-
Is there a way to somehow sync the 2 databases for the 2 apps with different package names without the use of external server? – Neha Agarwal May 23 '16 at 11:56
-
1@Orions I think this answer to my question is now outdated with the new Firebase SDK 9.0.0. – Steffen May 27 '16 at 18:56
1 Answers
30
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.

Sam Stern
- 24,624
- 13
- 93
- 124
-
Thank you so much! Though I didn't have to use FirebaseApp.initializeApp(), the information which you gave that another app can be added helped me. Thanks! – Neha Agarwal May 23 '16 at 18:59
-
I wonder if it's a new feature of Firebase 9.0.0 to add 2 (or more?) apps under one project? Or maybe it's still against their Terms of Service and they will disable it in the future? – Steffen May 27 '16 at 18:58
-
-
For more information: [checkThisLink](https://firebase.googleblog.com/2016/12/working-with-multiple-firebase-projects-in-an-android-app.html) – Meet Vora Apr 21 '17 at 11:17
-
Very helpful post, thank you! My need is the same as the person who posted: 1 app for posting data, 1 app only for fetching data. – Lucy May 01 '17 at 12:04
-
@hatboysam Could you please shed some light on my related question, I can't seem to get it working. https://stackoverflow.com/questions/44866220 – bibscy Jul 02 '17 at 12:59