Home » Android » android – Disable the Analytics service for Firebase Cloud Messaging

android – Disable the Analytics service for Firebase Cloud Messaging

Posted by: admin June 15, 2020 Leave a comment


We mirgrated from GCM to FCM without any problems. The notification service is running very well. However, we have to disable the app measurement part of the Firebase Analytics service for legal reasons.

We used this guide to disable the analytics part

So we put this flag to the manifest file:

<meta-data android:name="firebase_analytics_collection_enabled" android:value=false />

and we also disabled the collection programmatically:


Unfortunately, data is still collected and we can see new events in the Firebase Analytics Console. Is there any possibility to turn off the analytics services completely?

Thanks for your help.

Edit: I also have the deactivation meta-data in the application tag:

<meta-data android:name="firebase_analytics_collection_deactivated" android:value=true />
How to&Answers:

As of Oct 2017, deactivated value must be “true”. “false” won’t work anymore.

        android:value="true" />

The log shows correctly that it’s working.

10-11 16:29:32.755 27857-27857/? I/FA: Collection disabled with firebase_analytics_collection_deactivated=1


This is a Firebase bug or an error in the documentation for disabling Analytics collection. To permanently disable collection set firebase_analytics_collection_deactivated to false (not true):

        android:value="false" />

You can confirm that collection is disabled by enabling Analytics logging:

adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC

and observing output such as this:

I/FA: Collection disabled with firebase_analytics_collection_deactivated=1
D/FA: Event not sent since app measurement is disabled


In order to fully disable Analytics from the Firebase Messaging you need to exclude the analytics packages in gradle:

implementation('com.google.firebase:firebase-messaging:18.0.0') {
    exclude group: 'com.google.firebase', module: 'firebase-core'
    exclude group: 'com.google.firebase', module: 'firebase-analytics'
    exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'

And also deactivate tracking in the AndroidManifest file:

<meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" />
    <meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />
    <meta-data android:name="firebase_messaging_auto_init_enabled" android:value="false" />

If you are using proguard then you have to also add this line to the configuration file

-dontwarn com.google.firebase.analytics.connector.AnalyticsConnector

I hope this helps everyone else that does not want to include any form of tracking in their app but still use Firebase Cloud Messaging.


I tried putting that line in my manifest, inside the application tag, as the first line under the application tag :

    <meta-data android:name="firebase_analytics_collection_enabled" android:value="false" />

When doing so, during the init, Firebase display in the logs:

I/FA: Collection disabled with firebase_analytics_collection_enabled=0

And it seems not to report anything to firebase afterwards.


Just received feedback from the Firebase support team.

The code for manifest file won’t compile if you don’t add a double
quote in the android:value attribute, good job if you’ve already added

Temporarily disabling the analytics collection should work, could you
please try to enable the verbose debug option and check the logs?

On the other hand, we are aware that there’s an issue with disabling
the analytics collection permanently, there’s already a bug filed for
this and being prioritized by our engineers appropriately. Please keep
updated with our release notes for further notice regarding this

We apologise for any inconvenience that this may have caused you, and
we appreciate your understanding as we continue to improve our
services, moving forward.