Okihita
Okihita

Reputation: 177

How do I get Firebase's project name from Android?

I have an app with Firebase integrated. We switch back and forth between project "Development" and project "Production" in Firebase.

enter image description here

On Android, switching the project is done by replacing the google-services.json file. Is there any way I can get the Firebase's project name (i.e. Temu Production and Temu Development) from inside Android? Something like FirebaseApp.getInstance().getProjectName()?

I'm new to Firebase so I'm open to various approaches on project management and infrastructure.

Upvotes: 9

Views: 5707

Answers (1)

Guven
Guven

Reputation: 2310

The project name is provided by the FirebaseApp class.

Android:

FirebaseApp.getInstance().getOptions().getProjectId() should do the trick.

iOS (Swift):

FirebaseApp.app()?.options.projectID works well.

Upvotes: 22

Related Questions