Skip to content

🐛 [firebase_messaging] getInitialMessage() returns remoteMessage without clicking on the notification #8979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zaidalsaied opened this issue Jun 27, 2022 · 6 comments · Fixed by #9315
Assignees
Labels
platform: ios Issues / PRs which are specifically for iOS. plugin: messaging type: bug Something isn't working

Comments

@zaidalsaied
Copy link

zaidalsaied commented Jun 27, 2022

Bug report

Describe the bug
Whenever a remoteMessage is received getInitailMessage() returns the remoteMessage even if the user didn't click on the notification. It is expected to return null because the application has not been opened from a terminated state via a remoteMessage, it has been opened by clicking on the app itself.

i'm using: firebase_messaging: ^11.4.2
platform: ios

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
[✓] Flutter (Channel stable, 3.0.2, on macOS 12.3.1 21E258 darwin-arm, locale en-JO)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Android Studio (version 2021.2)
[✓] Connected device (2 available)
    ! Error: iPhone is busy: Fetching debug symbols for iPhone. Xcode will continue when iPhone is finished. (code -10)
[✓] HTTP Host Availability

• No issues found!


Flutter dependencies

Click To Expand
Dart SDK 2.17.3
Flutter SDK 3.0.2
school_ets 2.0.3+25

dependencies:
- cached_network_image 3.2.1 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web]
- carousel_slider 4.1.1 [flutter]
- cool_alert 1.1.0 [flutter flare_flutter lottie vector_math]
- cupertino_icons 1.0.5
- file_picker 4.6.1 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface ffi path win32]
- firebase_core 1.18.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_messaging 11.4.2 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- flutter_app_badger 1.4.0 [flutter]
- flutter_html 2.2.1 [html csslib flutter_layout_grid video_player chewie webview_flutter chewie_audio flutter_svg flutter_math_fork collection numerus flutter]
- flutter_image_slideshow 0.1.2 [flutter]
- flutter_local_notifications 9.6.1 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone]
- flutter_native_splash 2.2.0+1 [args flutter flutter_web_plugins image js lint meta path universal_io xml yaml]
- flutter_phoenix 1.0.0 [flutter]
- flutter_spinkit 5.1.0 [flutter]
- flutter_svg 0.23.0+1 [flutter meta path_drawing vector_math xml]
- fluttertoast 8.0.9 [flutter flutter_web_plugins]
- hive 2.2.2 [meta crypto]
- hive_flutter 1.1.0 [flutter hive path_provider path]
- http 0.13.4 [async http_parser meta path]
- photo_view 0.13.0 [flutter]
- provider 6.0.3 [collection flutter nested]
- syncfusion_flutter_calendar 20.1.61 [flutter timezone syncfusion_flutter_core syncfusion_flutter_datepicker intl]
- syncfusion_flutter_pdfviewer 20.1.61-beta [flutter vector_math async http uuid syncfusion_pdfviewer_platform_interface syncfusion_pdfviewer_web syncfusion_pdfviewer_macos syncfusion_pdfviewer_windows syncfusion_flutter_core syncfusion_flutter_pdf]
- upgrader 4.4.0 [flutter device_info_plus http os_detect package_info_plus shared_preferences url_launcher version xml html]
- url_launcher 6.1.4 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]

dev dependencies:
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph]

transitive dependencies:
- archive 3.3.0 [crypto path]
- args 2.3.1
- async 2.8.2 [collection meta]
- boolean_selector 2.1.0 [source_span string_scanner]
- cached_network_image_platform_interface 1.0.0 [flutter flutter_cache_manager]
- cached_network_image_web 1.0.1 [flutter flutter_cache_manager cached_network_image_platform_interface]
- characters 1.2.0
- charcode 1.3.1
- chewie 1.3.4 [cupertino_icons flutter provider video_player wakelock]
- chewie_audio 1.3.0 [cupertino_icons flutter video_player]
- clock 1.1.0
- collection 1.16.0
- convert 3.0.2 [typed_data]
- crypto 3.0.2 [typed_data]
- csslib 0.17.2 [source_span]
- dbus 0.7.3 [args ffi meta xml]
- device_info_plus 4.0.0 [flutter device_info_plus_platform_interface device_info_plus_macos device_info_plus_linux device_info_plus_web device_info_plus_windows]
- device_info_plus_linux 2.1.1 [device_info_plus_platform_interface file flutter meta]
- device_info_plus_macos 2.2.3 [device_info_plus_platform_interface flutter]
- device_info_plus_platform_interface 2.3.0+1 [flutter meta plugin_platform_interface]
- device_info_plus_web 2.1.0 [device_info_plus_platform_interface flutter_web_plugins flutter]
- device_info_plus_windows 2.1.1 [device_info_plus_platform_interface ffi flutter win32]
- fake_async 1.3.0 [clock collection]
- ffi 1.2.1
- file 6.1.2 [meta path]
- firebase_core_platform_interface 4.4.1 [collection flutter meta plugin_platform_interface]
- firebase_core_web 1.6.5 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_messaging_platform_interface 3.5.2 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 2.4.2 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- flare_flutter 3.0.2 [collection flutter meta]
- flutter_blurhash 0.7.0 [flutter]
- flutter_cache_manager 3.3.0 [clock collection file flutter http path path_provider pedantic rxdart sqflite uuid]
- flutter_layout_grid 1.0.6 [flutter collection meta quiver]
- flutter_local_notifications_linux 0.5.0+1 [flutter flutter_local_notifications_platform_interface dbus path xdg_directories]
- flutter_local_notifications_platform_interface 5.0.0 [flutter plugin_platform_interface]
- flutter_math_fork 0.5.0 [flutter flutter_svg provider meta collection tuple]
- flutter_plugin_android_lifecycle 2.0.6 [flutter]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math]
- html 0.15.0 [csslib source_span]
- http_parser 4.0.1 [collection source_span string_scanner typed_data]
- image 3.1.3 [archive meta xml]
- intl 0.17.0 [clock path]
- js 0.6.4
- lint 1.8.2
- lottie 1.3.0 [archive flutter path vector_math]
- matcher 0.12.11 [stack_trace]
- material_color_utilities 0.1.4
- meta 1.7.0
- nested 1.0.0 [flutter]
- numerus 1.1.1
- octo_image 1.0.2 [flutter flutter_blurhash]
- os_detect 2.0.1
- package_info_plus 1.4.2 [flutter package_info_plus_platform_interface package_info_plus_linux package_info_plus_macos package_info_plus_windows package_info_plus_web]
- package_info_plus_linux 1.0.5 [package_info_plus_platform_interface flutter path]
- package_info_plus_macos 1.3.0 [flutter]
- package_info_plus_platform_interface 1.0.2 [flutter meta plugin_platform_interface]
- package_info_plus_web 1.0.5 [flutter flutter_web_plugins http meta package_info_plus_platform_interface]
- package_info_plus_windows 1.0.5 [package_info_plus_platform_interface ffi flutter win32]
- path 1.8.1
- path_drawing 0.5.1+1 [vector_math meta path_parsing flutter]
- path_parsing 0.2.1 [vector_math meta]
- path_provider 2.0.11 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
- path_provider_android 2.0.16 [flutter path_provider_platform_interface]
- path_provider_ios 2.0.10 [flutter path_provider_platform_interface]
- path_provider_linux 2.1.7 [ffi flutter path path_provider_platform_interface xdg_directories]
- path_provider_macos 2.0.6 [flutter path_provider_platform_interface]
- path_provider_platform_interface 2.0.4 [flutter platform plugin_platform_interface]
- path_provider_windows 2.0.7 [ffi flutter path path_provider_platform_interface win32]
- pedantic 1.11.1
- petitparser 5.0.0 [meta]
- platform 3.1.0
- plugin_platform_interface 2.1.2 [meta]
- process 4.2.4 [file path platform]
- quiver 3.1.0 [matcher]
- rxdart 0.27.4
- shared_preferences 2.0.15 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows]
- shared_preferences_android 2.0.12 [flutter shared_preferences_platform_interface]
- shared_preferences_ios 2.1.1 [flutter shared_preferences_platform_interface]
- shared_preferences_linux 2.1.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface]
- shared_preferences_macos 2.0.4 [flutter shared_preferences_platform_interface]
- shared_preferences_platform_interface 2.0.0 [flutter]
- shared_preferences_web 2.0.4 [flutter flutter_web_plugins shared_preferences_platform_interface]
- shared_preferences_windows 2.1.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
- sky_engine 0.0.99
- source_span 1.8.2 [collection path term_glyph]
- sqflite 2.0.2+1 [flutter sqflite_common path]
- sqflite_common 2.2.1+1 [synchronized path meta]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- string_scanner 1.1.0 [charcode source_span]
- syncfusion_flutter_core 20.1.61 [vector_math flutter]
- syncfusion_flutter_datepicker 20.1.61 [flutter intl syncfusion_flutter_core]
- syncfusion_flutter_pdf 20.1.61-beta [flutter intl xml syncfusion_flutter_core crypto convert]
- syncfusion_pdfviewer_macos 20.1.61-beta [flutter syncfusion_pdfviewer_platform_interface]
- syncfusion_pdfviewer_platform_interface 20.1.61-beta [flutter plugin_platform_interface]
- syncfusion_pdfviewer_web 20.1.61-beta [flutter flutter_web_plugins js meta syncfusion_pdfviewer_platform_interface]
- syncfusion_pdfviewer_windows 20.1.61-beta [flutter]
- synchronized 3.0.0+2
- term_glyph 1.2.0
- test_api 0.4.9 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
- timezone 0.8.0 [path]
- tuple 2.0.0 [quiver]
- typed_data 1.3.1 [collection]
- universal_io 2.0.4 [collection crypto meta typed_data]
- url_launcher_android 6.0.17 [flutter url_launcher_platform_interface]
- url_launcher_ios 6.0.17 [flutter url_launcher_platform_interface]
- url_launcher_linux 3.0.1 [flutter url_launcher_platform_interface]
- url_launcher_macos 3.0.1 [flutter url_launcher_platform_interface]
- url_launcher_platform_interface 2.1.0 [flutter plugin_platform_interface]
- url_launcher_web 2.0.12 [flutter flutter_web_plugins url_launcher_platform_interface]
- url_launcher_windows 3.0.1 [flutter url_launcher_platform_interface]
- uuid 3.0.6 [crypto]
- vector_math 2.1.2
- version 3.0.2
- video_player 2.4.5 [flutter html video_player_android video_player_avfoundation video_player_platform_interface video_player_web]
- video_player_android 2.3.6 [flutter video_player_platform_interface]
- video_player_avfoundation 2.3.5 [flutter video_player_platform_interface]
- video_player_platform_interface 5.1.3 [flutter plugin_platform_interface]
- video_player_web 2.0.10 [flutter flutter_web_plugins video_player_platform_interface]
- wakelock 0.6.1+2 [flutter meta wakelock_macos wakelock_platform_interface wakelock_web wakelock_windows]
- wakelock_macos 0.4.0 [flutter flutter_web_plugins wakelock_platform_interface]
- wakelock_platform_interface 0.3.0 [flutter meta]
- wakelock_web 0.4.0 [flutter flutter_web_plugins js wakelock_platform_interface]
- wakelock_windows 0.2.0 [flutter wakelock_platform_interface win32]
- webview_flutter 2.8.0 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview]
- webview_flutter_android 2.8.14 [flutter webview_flutter_platform_interface]
- webview_flutter_platform_interface 1.9.1 [flutter meta plugin_platform_interface]
- webview_flutter_wkwebview 2.8.1 [flutter path webview_flutter_platform_interface]
- win32 2.6.1 [ffi]
- xdg_directories 0.2.0+1 [meta path process]
- xml 5.4.1 [collection meta petitparser]
- yaml 3.1.1 [collection source_span string_scanner]

@zaidalsaied zaidalsaied added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Jun 27, 2022
@darshankawar darshankawar added the triage Issue is currently being triaged. label Jun 28, 2022
@darshankawar
Copy link

Thanks for the report @zaid17.
Can you confirm if you are using this commit code which might be leading to the behavior you are seeing ?
If so, can you try to revert that commit and try again to see if expected behavior occurs or not ?

@darshankawar darshankawar added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Jun 28, 2022
@zaidalsaied
Copy link
Author

Thanks for the response @darshankawar.
Yes, I'm using it, and after deleting this statement the expected behavior occurs.
// If remoteNotification exists, it is the notification that opened the app. _initialNotification = [FLTFirebaseMessagingPlugin remoteMessageUserInfoToDict:remoteNotification];

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Jun 28, 2022
@darshankawar
Copy link

Thanks for confirming. Does your code use this already ?

@darshankawar darshankawar added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Jun 28, 2022
@zaidalsaied
Copy link
Author

Yes, my code uses it already.

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Jun 28, 2022
@darshankawar
Copy link

Thanks for the update. I am going ahead and labeling it based on above confirmation.
Same behavior is reported here and here.

@darshankawar
Copy link

/cc @russellwheatley

@darshankawar darshankawar added plugin: messaging platform: ios Issues / PRs which are specifically for iOS. and removed Needs Attention This issue needs maintainer attention. triage Issue is currently being triaged. labels Jun 28, 2022
@russellwheatley russellwheatley self-assigned this Jun 30, 2022
@firebase firebase locked and limited conversation to collaborators Sep 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: ios Issues / PRs which are specifically for iOS. plugin: messaging type: bug Something isn't working
Projects
None yet
4 participants