Describe your environment
Describe the problem:
As mentioned in the docs to prevent auto initialisation of fcm tokens we may add firebase_messaging_auto_init_enabled flag to be false in AndroidManifest.xml.
<!--Disables the auto init of FCM-->
<meta-data android:name="firebase_messaging_auto_init_enabled"
android:value="false" />
but this does not seem to work as token is still being generated automatically when the app starts.
The same problem
Thanks for flagging this issue @shubhamvashisht and @BulatMukhutdinov I'm digging into this further I'll report back here with an update.
You also need to disable analytics which also uses Firebase Instance ID. So the required metadata would be:
<meta-data android:name="firebase_messaging_auto_init_enabled" android:value="false"/>
<meta-data android:name="firebase_analytics_collection_enabled" android:value="false" />
Note however that 15.0.0 is required for firebase_analytics_collection_enabled field, it existed previously however a bug was fixed in 15.0.0.
We are also updating the documentation to make this clearer. Thanks again for flagging.
Setting the boolean programmatically works as expected without workaround, I presume?
What about the first run of the app though? Since the default is true and I set it to false when my code is reached, I guess a token will be requested automatically once, right?
Correct there is a possibility that the token will be generated before the code used for setting to false is run. So if you want to ensure that it does not get generated at all use version 15 or higher
I have both
<meta-data android:name="firebase_messaging_auto_init_enabled" android:value="false"/>
<meta-data android:name="firebase_analytics_collection_enabled" android:value="false" />
in my Manifest.xml but still not working.
firebase-core:16.0.8
firebase-messaging:17.6.0
Seems like I have the same issue. Also have both meta-data in manifest.
firebaseCoreVersion = '16.0.7'
firebaseMessagingVersion = '17.4.0'
I have the same issue. Also have both meta-data in the manifest.
playServicesBase = '16.1.0'
firebaseCoreVersion = '16.0.7'
firebaseMessagingVersion = '17.4.0'
Can you help?
I created a new topic https://github.com/firebase/quickstart-android/issues/881 because the issue didn't solve
Most helpful comment
The same problem