I have been looking for a method in order to add the google-services.json at runtime as we use same base code to configure the application for the different client, hence we want to add google-services.json at runtime.
I have tried several links but am unable to find such a way to do it.
Any help will be very much appreciated.
The
google-services.jsonis actually never read at runtime. During the build process of your Android app, the relevant information fromgoogle-services.jsonis translated into your App's XML resources, and that is where it's read when the app starts. Since the destination where the build plugin puts the values is hard-wired, you can't configure it to have multiple sets of configuration data.Instead of trying to read
google-services.jsonat runtime, I'd recommend configuring theFirebaseAppinstance in your code explicitly, like this:Now you can determine yourself where to keep the relevant information from the
google-services.jsonand which ones to use when the app starts.and then:
Also see: