Politchi Li
Politchi Li

Reputation: 11

How can we dynamically configure the Firebase keys through FirebaseOptions instead of putting the google-services.json file into the project?

I want to configure Firebase dynamically so that anyone who uses my project can use the configurations in their own google-services.json files. Here's what I've done: I put the google-services.json file into the Android project, but configured the key and other critical contents inside it as other strings, because otherwise the compilation wouldn't pass. After the application is launched, it loads the google-services.json file from the outside, parses out the contents like the keys, uses FirebaseOptions to configure and calls the FirebaseApp.initializeApp method to initialize Firebase. Finally, crash logs are reported, but there's no data for the custom key events that I defined.

I want to know if there is any way to dynamically configure Firebase without putting the "google-services.json file" in the Android project. Additionally, I also want to know whether it is because there is a problem with my initial configuration that the key events are not reported, or if I am missing other configurations in the console, which makes my custom key events invalid?

Upvotes: 0

Views: 23

Answers (0)

Related Questions