2

I am trying to add Firebase to an existing Android app, but I'm having trouble deciding what parts of the provided google-services.json file I should import into my app. I can't override it because the json file Firebase spits out doesn't have all the info I need. Does anyone know what exactly I need to add? Thanks in advance!

Edit to add some sample code: This is what firebase gives me: { "project_info": { "project_number": "a project project number", "firebase_url": "https://my-project.firebaseio.com", "project_id": "a project id", "storage_bucket": "my-project.appspot.com" }, "client": [{ "client_info": { "mobilesdk_app_id": "an id", "android_client_info": { "package_name": "my-package-name" } }, "oauth_client": [ ... ], "api_key": [{ "current_key": "a key" }], "services": { ... } }], "configuration_version": "1" }

And this is what I have on my project: { "project_info": { "project_id": "a different project id", "project_number": "a different project number" }, "client": [{ "client_info": { "mobilesdk_app_id": "a different id", "client_id": "android:my-package-name", "client_type": 1, "android_client_info": { "package_name": "my-package-name" } }, "oauth_client": [ ... ], "api_key": [], "services": { ... } } ], "client_info": [], "ARTIFACT_VERSION": "1" }

maga
  • 21
  • 3
  • 1
    The values are http://stackoverflow.com/questions/37634767/how-to-connect-to-more-than-one-firebase-database-from-an-android-app/37643374#37643374 – Frank van Puffelen Sep 02 '16 at 03:12
  • What exactly is missing? I've never heard of a google-services.json being insufficient for the plugin to use to build an app. – Doug Stevenson Sep 03 '16 at 00:58
  • Thanks @FrankvanPuffelen, I've already added the firebase_url, but I'm not sure what to do with the mobilesdk_app_id and api_key... Do I create a new client in the array with just that info? Or do I copy the entire client provided on the json Firebase gives me? Thank you! – maga Sep 06 '16 at 13:22
  • @DougStevenson Well, the JSON provided by the Firebase console does not have all the info I have added to my project's file. For example, it's missing services, among many other things. So I thought it would be easier to just port over whatever fields are needed for Firebase, but turns out that part is not very well documented, they just assume their file will have everything you need and you just override the one you have. – maga Sep 06 '16 at 13:24
  • You're clearly trying to make some code work. Show the [minimal code that reproduces the problem](http://stackoverflow.com/help/mcve) you currently have and we'll have a better chance of being helpful. – Frank van Puffelen Sep 06 '16 at 15:01
  • @FrankvanPuffelen great idea! I've added it to the original post. Thanks again! – maga Sep 07 '16 at 13:45

0 Answers0