To completely disable analytics from Firebase Messaging, you need to exclude 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 disable 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 also need to add this line to the configuration file
-dontwarn com.google.firebase.analytics.connector.AnalyticsConnector
I hope this helps everyone who does not want to include any forms of tracking in their applications, but still uses Firebase Cloud Messaging.
Ilber source share