Skip to content

🐛 [firebase_messaging] getInitialMessage() does not terminate on macOS if app starts from terminated state #11014

@Lootwig

Description

@Lootwig
Contributor

Bug report

The method works as expected on iPad, but on macOS any code after getInitialMessage() is never executed.

Steps to reproduce

Steps to reproduce the behavior:

  1. Add any behavior after await FirebaseMessaging.instance.getInitialMessage(), e.g. showDialog()
  2. Close app and trigger a push notification
  3. Click notification: App opens, but the behavior from 1. is never observed

Sample project

GitHub

Configure this project with flutterfire configure, set up XCode for signing etc.


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.10.1, on macOS 13.3.1 22E772610a darwin-arm64, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc2)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[✓] Android Studio
[✓] IntelliJ IDEA Ultimate Edition (version 2023.2 EAP)
[✓] IntelliJ IDEA Ultimate Edition (version EAP IU-232.5150.116)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.2)
[✓] IntelliJ IDEA Ultimate Edition (version EAP IU-232.6095.10)
[✓] VS Code (version 1.78.2)
[✓] VS Code (version 1.79.0-insider)
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 1 category.

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand
Dart SDK 3.0.1
Flutter SDK 3.10.1
initial_message 0.1.0

dependencies:
- firebase_core 2.13.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_messaging 14.6.1 [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_lints 2.0.1 [lints]
- 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]

transitive dependencies:
- _flutterfire_internals 1.3.1 [collection firebase_core firebase_core_platform_interface flutter meta]
- async 2.11.0 [collection meta]
- boolean_selector 2.1.1 [source_span string_scanner]
- characters 1.3.0
- clock 1.1.1
- collection 1.17.1
- fake_async 1.3.1 [clock collection]
- firebase_core_platform_interface 4.8.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 2.5.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_messaging_platform_interface 4.5.1 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 3.5.1 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math]
- js 0.6.7 [meta]
- lints 2.1.0
- matcher 0.12.15 [async meta stack_trace term_glyph test_api]
- material_color_utilities 0.2.0
- meta 1.9.1
- path 1.8.3
- plugin_platform_interface 2.1.4 [meta]
- 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]
- term_glyph 1.2.1
- test_api 0.5.1 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
- vector_math 2.1.4

Activity

darshankawar

darshankawar commented on May 22, 2023

@darshankawar

Thanks for the report @Lootwig
Per this documentation for macOS, can you confirm if the required permissions are configured properly ?

added
blocked: customer-responseWaiting for customer response, e.g. more information was requested.
and removed
Needs AttentionThis issue needs maintainer attention.
on May 22, 2023
Lootwig

Lootwig commented on May 22, 2023

@Lootwig
ContributorAuthor

@darshankawar The suggested default parameters are exactly the ones I left in the requestPermission() call. I am receiving the notification and it opens the app just fine. It's just the mentioned callback that doesn't terminate as it does on iPad and Android.

image
darshankawar

darshankawar commented on May 23, 2023

@darshankawar

Thanks for the update. Using the repo provided, I seem to be able to replicate the reported behavior.

/cc @Lyokone

added
platform: macosIssues / PRs which are specifically for MacOS.
and removed
blocked: customer-responseWaiting for customer response, e.g. more information was requested.
triageIssue is currently being triaged.
on May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Lootwig@darshankawar

        Issue actions

          🐛 [firebase_messaging] getInitialMessage() does not terminate on macOS if app starts from terminated state · Issue #11014 · firebase/flutterfire