Skip to content

🐛 [firebase_messaging] iOS FirebaseMessagingAutoInitEnabled = NO should prevent auto initialization and calls to https://fcmtoken.googleapis.com/register #10807

@adscooli

Description

@adscooli

Bug report

Describe the bug

Steps to reproduce

  1. Setup an empty Flutter project with Firebase messaging (without any calls to the lib in the code)
  2. 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
  3. Set FirebaseMessagingAutoInitEnabled = NO in your Info.plist file
    (according to this guide)
  4. Uninstall the app and analyze the traffic again
  5. 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

Info.plist:
grafik

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]


Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions