AnalyticsService 未在应用清单中注册 - 错误 [英] AnalyticsService not registered in the app manifest - error

查看:20
本文介绍了AnalyticsService 未在应用清单中注册 - 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 sdk 中提供的以下文档为 android 应用实现谷歌分析服务:

I am trying to implement google analytics service to android app using the following documentation provided in sdk:

https://developers.google.com/analytics/devguides/collection/android/v4/

我无法在分析管理站点中看到任何信息.

I am unable to see any information in the analytics admin site.

当应用程序运行时,我看到以下调试消息

While the app is running, I am seeing following debug message

AnalyticsService 未在应用清单中注册.可能无法可靠地传送命中.请参阅 https://developers.google.com/analytics/devguides/collection/android/v4/ 了解说明."

"AnalyticsService not registered in the app manifest. Hits might not be delivered reliably. See https://developers.google.com/analytics/devguides/collection/android/v4/ for instructions."

您能建议我如何注册此服务吗?

Can you please suggest me how to register this service?

推荐答案

我不确定对此警告采取行动是否能解决您遇到的问题(即在 Analytics 管理站点中看不到任何信息).

I am not sure if acting on this warning will solve the issue you're having (i.e. not seeing any information in the Analytics admin site).

无论如何,如果您想摆脱此警告,您应该在应用程序标签内的 AndroidManifest.xml 中添加以下内容:

Anyway, here is what you should add to AndroidManifest.xml inside the application tag if you want to get rid of this warning:

 <!-- Optionally, register AnalyticsReceiver and AnalyticsService to support background
      dispatching on non-Google Play devices -->
 <receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
     android:enabled="true">
     <intent-filter>
         <action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
     </intent-filter>
 </receiver>
 <service android:name="com.google.android.gms.analytics.AnalyticsService"
     android:enabled="true"
     android:exported="false"/>

 <!-- Optionally, register CampaignTrackingReceiver and CampaignTrackingService to enable
      installation campaign reporting -->
 <receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
     android:exported="true">
     <intent-filter>
         <action android:name="com.android.vending.INSTALL_REFERRER" />
     </intent-filter>
 </receiver>
 <service android:name="com.google.android.gms.analytics.CampaignTrackingService" />

您不必添加所有这些,只需添加您需要的即可.在您的情况下,您显然只需要添加 AnalyticsService 服务.

You don't have to add all of this, just add what you need. In your case, you apparently just need to add the AnalyticsService service.

来源:https://developer.android.com/reference/com/google/android/gms/analytics/GoogleAnalytics.html

这篇关于AnalyticsService 未在应用清单中注册 - 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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