Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to have 1 Firebase database for 2 apps with different package names?

Tags:

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?

like image 202
Neha Agarwal Avatar asked May 23 '16 11:05

Neha Agarwal


People also ask

Can two apps access same Firebase database?

Yes, it is! a single firebase database can be access by multiple app.. provided each of your apps use the same authentication details.

Can a Firebase project have multiple apps?

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).

Can I use two Firebase for my website?

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.

How do I create a multiple Realtime Database in Firebase?

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.


1 Answers

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.

like image 144
Sam Stern Avatar answered Oct 03 '22 08:10

Sam Stern