AnalyticsService not registered in the app manifest - error

CreativeManix picture CreativeManix · May 10, 2015 · Viewed 31.6k times · Source

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 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?

Answer

Karim picture Karim · May 11, 2015

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).

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" />

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.

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