Home > Net >  Can I use two Firebase projects for one app just by changing google-services.json?
Can I use two Firebase projects for one app just by changing google-services.json?

Time:11-23

I want to create a development enviroment to test my app without touching the production firestore database. Therefore I want to use a second Firebase project, so one for production and one for development.

So far I just changed the google-services.json file from the production firebase project to the one for development. It works fine but is this all I need to do or is there a more recommended way?

The plan is to test everything with the google-services.json from the dev firebase project and when I finish developing I change to the google-services.json from the prod firebase project and ship it to the play store.

CodePudding user response:

Changing the google-services.json file depending on the build flavor is indeed a common way to select between projects at build time.

If you need to select at run time, dynamically creating and configuring the FirebaseApp object is a good option too.

What to pick mostly depends on the reason why you have separate projects, so I recommend checking the Firebase documentation in using multiple projects to help you decide.

  • Related