Is it possible to use Firebase Messaging with Google Analytics in Android?

这一生的挚爱 提交于 2019-12-18 15:29:25

问题


I started using Firebase Cloud Messaging for an Android app and now I'm trying to add Google Analytics (not Firebase analytics) to the same app.

The problem is that when creating google-services.json for Analytics, it ignores FCM. I'm using the same google account to create both json files.

I read that when enabling the second service (in this case Analytics) the json should update adding both Messaging and Analytics but maybe this only works within Firebase services?

I could use Firebase Analytics and actually that's what Google recommends, but is it possible to use both Google Analytics with Firebase services?


回答1:


Yes, it is possible to use Firebase Cloud Messaging and Google Analytics in the same app. I would suggest using the json file generated by Firebase and merging in the following object into the "services" object :

 "analytics_service": {
          "status": 2,
          "analytics_property": {
            "tracking_id": "<your tracking id>"
          }
        },


来源:https://stackoverflow.com/questions/37715288/is-it-possible-to-use-firebase-messaging-with-google-analytics-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!