AnalyticsService not registered in the app manifest - error
Solution 1
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
Solution 2
add this on manifest
<service android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false"/>
Solution 3
Karim explained it well, but it won't work until you give the Wake lock permission in the manifest.
<uses-permission android:name="android.permission.WAKE_LOCK" />
Related videos on Youtube
CreativeManix
Ambitious developer who is like to work on new technolgies. Expertise in modern web, cloud and mobile application development using .Net, C#, Azure, react-native and NodeJS. Not just development, I also work on Test automation using Selenium and Cypress. I enjoy technical challanges, writing common libraries, and learning new things. I love to watch gold fishes, always I keep them at my home office.
Updated on May 05, 2020Comments
-
CreativeManix about 4 years
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?
-
Manan Sharma almost 9 yearsCheck if you have initialized analytics in application class or the primary landing activity too. I recommend removing the global tracker (XML) code.
-
-
yi2ng2 almost 9 yearsI solved this through this method. However, one thing to take note for beginner is that these codes may need to be added inside "application" tag =)
-
Buddy over 8 yearsThe real question is why are these not present here : developers.google.com/analytics/devguides/collection/android/v4 ?
-
aandis over 8 years@EnesBattal maybe because these are required only on devices not having Google play services. But I too feel it should be mentioned in those docs.
-
aselims over 8 yearsGoogleAnalytics.getInstance(this).getLogger().setLogLevel(Logger.LogLevel.VERBOSE); is deprecated. Use "adb shell setprop log.tag.GAv4 DEBUG; adb logcat -s GAv4" instead
-
Mehlyfication over 8 yearsI added these to my manifest and now I no longer get the warning in LogCat, but when I enable debugging for GoogleAnalytics I still get them in the terminal? The commands I've used to enable debugging in Terminal: "adb shell setprop log.tag.GAv4 DEBUG" and "adb logcat -s GAv4"
-
IgorGanapolsky over 8 yearsYou are using deprecated methods.
-
Krzysztof Skrzynecki over 8 years@IgorGanapolsky it wasn't deprecated in Jun '15
-
Phileo99 about 8 years@zack, if the app is going to the Play Store, then that means you don't know what device the app will be installed into, therefore, it's implied that these services and receivers must be added to the manifest. Certainly in my case, I have several devices which have the Play services already installed, and this was the only way to get rid of the warnings in LogCat
-
deadfish over 7 yearswhat result in console should be displayed to be sure it made it working?