Two google-services.json (with different accounts)

2019-04-14 20:32发布

问题:

Is it possible, to use two different accounts for two different services of google in an Android app?

I want to use Google Analytics with Account customer@gmail.com and Firebase Crashreport with Account developer@gmail.com.

I get two google-services.json with different project_info values and can't combine them. The solution for different flavours is not relevant as I understand this, because I want to use 2 configuration files for the same flavour (release).

回答1:

You can't split between projects like this with Analytics and Crash Reporting. Crash Reporting actually depends pretty heavily on Analytics for some of its best features, such as the ability to trigger an Analytics event when there is a crash for a user.

You can, however, initialize different FirebaseApp instances that point to other projects if you want to use their Realtime Database and Storage features. There is a blog post on some of the use cases, but they don't apply here because of the way Analytics works.