是否可以在 Android 中使用 Firebase Messaging 和 Google Analytics? [英] Is it possible to use Firebase Messaging with Google Analytics in Android?

查看:24
本文介绍了是否可以在 Android 中使用 Firebase Messaging 和 Google Analytics?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始将 Firebase Cloud Messaging 用于 Android 应用,现在我尝试将 Google Analytics(不是 Firebase 分析)添加到同一个应用.

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.

问题在于,在为 Analytics 创建 google-services.json 时,它会忽略 FCM.我使用同一个谷歌帐户来创建两个 json 文件.

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.

我读到在启用第二个服务(在本例中为 Analytics)时,json 应该更新添加消息传递和分析,但也许这只适用于 Firebase 服务?

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?

我可以使用 Firebase Analytics,实际上这是 Google 推荐的,但是否可以同时使用 Google Analytics 和 Firebase 服务?

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

推荐答案

是的,可以在同一个应用程序中使用 Firebase Cloud Messaging 和 Google Analytics.我建议使用 Firebase 生成的 json 文件并将以下对象合并到服务"对象中:

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>"
          }
        },

这篇关于是否可以在 Android 中使用 Firebase Messaging 和 Google Analytics?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆