Dalon
Dalon

Reputation: 700

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

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.

Upvotes: 0

Views: 839

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 598847

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.

Upvotes: 2

Related Questions