rodolfo
rodolfo

Reputation: 65

dynamic google-service.json after apk is generated

I have an app that sync data with my API. I want this app have a dynamic "google-service.json", I want to pass the google-service.json after the app.APK is ready and the app is installed on the device through my API. Is possible ? I did a generic "google-service.json" that change the values when I send data from my API to the installed app on the device but the Firebase connection is not working. Any ideas ?

Upvotes: 0

Views: 1816

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317657

What you're asking isn't possible. The values from google-services.json are read at build time and added to your APK. There's no way to go back and changes those values later.

If you want to initialize Firebase based on values that can only be known when the app is launched, then you should NOT apply the google-sevices plugin in build.gradle, and instead call FirebaseApp.initializeApp() manually and pass the correct values that you see in google-services.json.

Read:

Upvotes: 5

Related Questions