3
votes

We are using two Firebase services in Android and iOS native Apps - Firebase Analytics and FCM (Firebase Cloud Messaging). These services are owned by two separate teams - Analytics team owns Firebase account containing analytics project, whereas IT team owns the one for FCM (containing FCM project). We also use UrbanAirship for PUSH messages that internally uses FCM key (API key from FCM project). Apps currently use google-services.json downloaded from Analytics account and hence analytics events flows just fine.

But PUSH notifications don't work since UA(UrbanAirship) account contains FCM API key from different account. As a temporarily fix, we configured UA to use FCM key from Analytics project (as app uses JSON from analytics account only) which I think is not appropriate for long run, it brings dependency among two teams. Please share your expert opinion on best practice in this case, so both teams (Analytics, IT) can independently manage their (separate) accounts.

Please note that I went through couple of other threads copied below but they refer to handling with multiple projects, not separate accounts. So posted this question. Thanks !

Can one single application connect with multiple Firebase Account?

Use multiple firebase accounts in single android app for google analytics

1
The accepted answer to the second question you linked sounds like the most promising approach here: stackoverflow.com/a/45547035/209103. The fact that the projects are owned by different accounts has no impact here.Frank van Puffelen
Hi @FrankvanPuffelen, thanks for sharing pointers. I'll check and get back.Birender Singh

1 Answers

0
votes

Finally, we got a solution to above problem and thought of sharing with all so it helps others as well. "As of date" (not sure about future updates): Firebase Analytics SDK (in fact many other Firebase features too) in Android project depends on google-services.JSON file that we download from Firebase console (respective project) and use in Android project.

In contrast, PUSH notification via Urban Airship (UA) SDK doesn't have any dependency on google-services.JSON, in fact it depends on airshipconfig.properties file settings only.

As a result we can maintain different Firebase accounts e.g. one controlled by Analytics team and other by IT team for PUSH notifications (integrated with Urban Airship) in our case.

Please note that UA server side settings (at console) and in Android App (airshipconfig.properties) can be setup as follows:

UA console - Under Settings->Platforms->Android->API Key section use the API key copied from Firebase console->Settings->Cloud Messaging->Server Key. See sample screenshot copied below.

Android App (airshipconfig.properties) - use the "Sender ID" from same section in Firebase console mentioned above. The API key and SenderID makes association between client and server components.

Firebase Analytics Console Keys

UrbanAirship console settings

iOS App - Since iOS App relies on APNS and not Firebase FCM, no specific keys need to be setup in Urban Airship console for same. However, the certificate need to be supplied in UA console.