Repository navigation
Closed
Labels
platform: iosIssues / PRs which are specifically for iOS.plugin: messagingtype: bugSomething isn't workingtype: documentationImprovements or additions to documentation
Description
Bug report
Describe the bug
Steps to reproduce
- Setup an empty Flutter project with Firebase messaging (without any calls to the lib in the code)
- Start the app and analyze app traffic (We used proxyman on a real device)
-> POST https://fcmtoken.googleapis.com/register will be called on appstart - Set FirebaseMessagingAutoInitEnabled = NO in your Info.plist file
(according to this guide) - Uninstall the app and analyze the traffic again
- https://fcmtoken.googleapis.com/register will still be called on appstart
Expected behavior
The token registration is delayed until Messaging.messaging().autoInitEnabled = true is called
Additional context
The requests aren't called if firebase_messaging is removed from pubspec.yaml
Use Case:
We have to prevent data collection until users accepts the policies. Auto initialization and HTTP requests should be disabled until a user opt in. We followed this doc to achieve this.
Flutter doctor
Run flutter doctor and paste the output below:
Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.11, on macOS 13.3.1 22E261 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2022.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
Flutter dependencies
Run flutter pub deps -- --style=compact and paste the output below:
Click To Expand
Dart SDK 2.19.6
Flutter SDK 3.7.11
sample 1.0.0+1
dependencies:
- firebase_messaging 14.4.0 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- flutter 0.0.0 [characters collection js material_color_utilities meta vector_math sky_engine]
dev dependencies:
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters collection js matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph]
- integration_test 0.0.0 [flutter flutter_driver flutter_test path vm_service archive async boolean_selector characters clock collection crypto fake_async file js matcher material_color_utilities meta source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api typed_data vector_math webdriver]
transitive dependencies:
- _flutterfire_internals 1.1.0 [collection firebase_core firebase_core_platform_interface flutter meta]
- archive 3.3.2 [crypto path]
- async 2.10.0 [collection meta]
- boolean_selector 2.1.1 [source_span string_scanner]
- characters 1.2.1
- clock 1.1.1
- collection 1.17.0
- crypto 3.0.2 [typed_data]
- fake_async 1.3.1 [clock collection]
- file 6.1.4 [meta path]
- firebase_core 2.9.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_core_platform_interface 4.6.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 2.3.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_messaging_platform_interface 4.3.0 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 3.3.0 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- flutter_driver 0.0.0 [file flutter flutter_test fuchsia_remote_debug_protocol path meta vm_service webdriver archive async boolean_selector characters clock collection crypto js matcher material_color_utilities platform process source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api typed_data vector_math]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math]
- fuchsia_remote_debug_protocol 0.0.0 [process vm_service file meta path platform]
- js 0.6.5 [meta]
- matcher 0.12.13 [meta stack_trace]
- material_color_utilities 0.2.0
- meta 1.8.0
- path 1.8.2
- platform 3.1.0
- plugin_platform_interface 2.1.4 [meta]
- process 4.2.4 [file path platform]
- sky_engine 0.0.99
- source_span 1.9.1 [collection path term_glyph]
- stack_trace 1.11.0 [path]
- stream_channel 2.1.1 [async]
- string_scanner 1.2.0 [source_span]
- sync_http 0.3.1
- term_glyph 1.2.1
- test_api 0.4.16 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.1 [collection]
- vector_math 2.1.4
- vm_service 9.4.0
- webdriver 3.0.1 [archive matcher path stack_trace sync_http]
Reacted by Jack Gibbons
Metadata
Metadata
Assignees
Labels
platform: iosIssues / PRs which are specifically for iOS.plugin: messagingtype: bugSomething isn't workingtype: documentationImprovements or additions to documentation

Activity
darshankawar commentedon Apr 18, 2023
This is coming from native iOS SDK.
I couldn't find any reference or documentation from client side on auto initialization, so will keep this issue open for team's feedback.
/cc @Lyokone
Lyokone commentedon Apr 19, 2023
@darshankawar The Flutter documentation states the same thing https://firebase.google.com/docs/cloud-messaging/flutter/client#prevent-auto-init
@adscooli You mention but should use
await FirebaseMessaging.instance.setAutoInitEnabled(true);in your Dart code when you want to activate auto init.If using the issue persists when using the correct Dart code, I'll open an issue in the native iOS SDK repository.
Lyokone commentedon Apr 19, 2023
I also found this piece of information: firebase/quickstart-unity#657 (comment); I'll try to see if FlutterFire doesn't make a call to the native SDK by mistake.
adscooli commentedon Apr 19, 2023
Thanks for the quick responses.
@Lyokone
We removed
await FirebaseMessaging.instance.setAutoInitEnabled(true);just to investigate this issue.In general the push messages work fine. We just need help with the opt in.
refering to the other issue
We don't have any code related to firebase currently in the project. It's basically an empty flutter project with the firebase_messaging dependency. (and the required GoogleService-Info.plist file). So the call musst be automatically triggered by a dependency.
In the meantime we did the same with Analytics link and Crashlytics link in the main project, which worked as expected and removed the related requests on appstart.
Also there are not much log outputs on appstart in the sample, still FirebaseMessaging tries to initialize something
Click To Expand Logs
cremfert commentedon May 16, 2024
I have the same issue, did you find a solution?
leifhacks commentedon Mar 10, 2025
This still seems to happen. I am also really interested in a fix or workaround for this.