I have an app with Firebase integrated. We switch back and forth between project "Development" and project "Production" in Firebase.
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.
Go to the API Console. From the projects list, select Manage all projects. The names and IDs for all the projects you're a member of are displayed.
There is no way to change the ID of a project. You have to create a new one.
However, when you want to access multiple projects from a single application, you'll need a distinct Firebase application object to reference each one individually. It's up to you to initialize these other instances.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With