Closed OutdatedGuy closed 1 year ago
Hi @OutdatedGuy, please provide a complete minimal reproducible code sample (preferably in a repo) so that we can investigate this issue.
Thank you
While creating reproducible code sample, I got to know that even though I was not adding notification
directly, I was adding it in android
. And that was creating the empty notification as the message.notification
in dart was not empty/null due to it.
When I set my server notification code without the notification
field in android
it is now working fine.
But it is still weird though, that the message/notification is displayed by FCM even when notification title
and body
are empty or null
.
I got my solution so I'll be closing this issue, but if the above behaviour is unexpected then @danagbemava-nc please re-open or create a new issue.
If anyone want to try/test this out, below is the sample code and steps to reproduce the issue.
Bug report
Describe the bug I'm sending FCM notification from my cloud functions to my flutter app.
I don't want the FCM system to handle notification display when the app is in background or terminated. Hence, I'm sending the data to show in notification in the
data
key instead of thenotification
key.Cloud Functions:
On the client side (i.e. Flutter app) I'm receiving/handling the FCM messages and displaying them with the awesome_notifications plugin.
Flutter:
This setup works properly when the app is in foreground but when in background or terminated it shows 2 notification. One proper and one totally empty notification.
I don't want the FCM SDK system to handle the notification hence I'm using
data
instead ofnotification
but then this problem arises.Expected behavior
Only one notification from
awesome_notification
package is shown (the one with proper data) and FCM does not show an empty notification.Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
``` [β] Flutter (Channel stable, 3.7.12, on macOS 13.3.1 22E772610a darwin-arm64, locale en-IN) [β] Android toolchain - develop for Android devices (Android SDK version 33.0.2) [β] Xcode - develop for iOS and macOS (Xcode 14.3) [β] Chrome - develop for the web [β] Android Studio (version 2022.2) [β] VS Code (version 1.78.0) [β] Connected device (4 available) [β] HTTP Host Availability β’ No issues found! ```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.12 client_app_5amclub 4.3.0+13 dependencies: - awesome_notifications 0.7.4+1 [flutter flutter_web_plugins plugin_platform_interface intl] - badges 3.1.1 [flutter] - cached_network_image 3.2.3 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web] - cloud_firestore 4.5.3 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - cloud_functions 4.1.1 [cloud_functions_platform_interface cloud_functions_web firebase_core firebase_core_platform_interface flutter] - cupertino_icons 1.0.5 - email_validator 2.1.17 - firebase_analytics 10.2.1 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter] - firebase_auth 4.4.2 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 2.10.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_crashlytics 3.1.2 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace] - firebase_messaging 14.4.1 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - firebase_performance 0.9.1+1 [firebase_core firebase_core_platform_interface firebase_performance_platform_interface firebase_performance_web flutter] - firebase_storage 11.1.1 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter] - flutter 0.0.0 [characters collection js material_color_utilities meta vector_math sky_engine] - flutter_dotenv 5.0.2 [flutter] - flutter_easyloading 3.0.5 [flutter flutter_spinkit] - flutter_svg 2.0.5 [flutter vector_graphics vector_graphics_codec vector_graphics_compiler] - font_awesome_flutter 10.4.0 [flutter] - get_storage 2.1.1 [flutter get path_provider] - google_fonts 4.0.4 [flutter http path_provider crypto] - image_cropper 3.0.3 [flutter image_cropper_platform_interface image_cropper_for_web] - image_picker 0.8.7+4 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_platform_interface] - intl_phone_field 3.1.0 [flutter] - just_the_tooltip 0.0.12 [flutter] - lottie 2.3.2 [archive flutter path vector_math] - pin_code_fields 7.4.0 [flutter] - provider 6.0.5 [collection flutter nested] - readmore 2.2.0 [flutter] - receive_sharing_intent 1.4.5 [flutter] - rounded_loading_button 2.1.0 [flutter rxdart] - stream_chat_flutter 6.0.0 [cached_network_image chewie collection contextmenu dart_vlc desktop_drop diacritic dio ezanimation file_picker file_selector flutter flutter_markdown flutter_portal flutter_svg http_parser image_gallery_saver image_picker jiffy lottie meta path_provider photo_manager photo_view rxdart share_plus shimmer stream_chat_flutter_core synchronized thumblr url_launcher video_player video_player_macos video_thumbnail] - upgrader 6.3.0 [flutter device_info_plus html http os_detect package_info_plus shared_preferences url_launcher version xml] - url_launcher 6.1.10 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] - uuid 3.0.7 [crypto] dev dependencies: - flutter_launcher_icons 0.13.1 [args checked_yaml cli_util image json_annotation path yaml] - flutter_lints 2.0.1 [lints] - flutter_native_splash 2.2.19 [args flutter flutter_web_plugins js html image meta path universal_io xml yaml] - 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] - package_rename 1.2.0 [args html logger universal_io yaml] transitive dependencies: - _flutterfire_internals 1.1.1 [collection firebase_core firebase_core_platform_interface flutter meta] - after_layout 1.2.0 [flutter] - animations 2.0.7 [flutter] - archive 3.3.7 [crypto path pointycastle] - args 2.4.1 - asn1lib 1.4.0 - async 2.10.0 [collection meta] - audio_video_progress_bar 0.11.0 [flutter] - boolean_selector 2.1.1 [source_span string_scanner] - cached_network_image_platform_interface 2.0.0 [flutter flutter_cache_manager] - cached_network_image_web 1.0.2 [flutter flutter_cache_manager cached_network_image_platform_interface] - characters 1.2.1 - checked_yaml 2.0.3 [json_annotation source_span yaml] - chewie 1.4.0 [cupertino_icons flutter provider video_player wakelock] - cli_util 0.4.0 [meta path] - clock 1.1.1 - cloud_firestore_platform_interface 5.12.1 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 3.4.2 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js] - cloud_functions_platform_interface 5.2.1 [firebase_core flutter meta plugin_platform_interface] - cloud_functions_web 4.4.1 [cloud_functions_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - collection 1.17.0 - connectivity_plus 3.0.6 [flutter flutter_web_plugins connectivity_plus_platform_interface js meta nm] - connectivity_plus_platform_interface 1.2.4 [flutter meta plugin_platform_interface] - contextmenu 3.0.0 [flutter animations after_layout] - convert 3.1.1 [typed_data] - cross_file 0.3.3+4 [js meta] - crypto 3.0.3 [typed_data] - crypto_keys 0.3.0+1 [pointycastle meta collection quiver] - csslib 0.17.2 [source_span] - dart_vlc 0.4.0 [flutter dart_vlc_ffi path audio_video_progress_bar] - dart_vlc_ffi 0.2.0+1 [ffi path] - dbus 0.7.8 [args ffi meta xml] - desktop_drop 0.4.1 [flutter flutter_web_plugins cross_file] - device_info_plus 8.2.2 [device_info_plus_platform_interface ffi file flutter flutter_web_plugins meta win32] - device_info_plus_platform_interface 7.0.0 [flutter meta plugin_platform_interface] - diacritic 0.1.3 - dio 5.1.1 [http_parser meta path] - equatable 2.0.5 [collection meta] - ezanimation 0.6.0 [flutter] - fake_async 1.3.1 [clock collection] - ffi 2.0.1 - file 6.1.4 [meta path] - file_picker 5.2.10 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface ffi path win32] - file_selector 0.9.3 [file_selector_ios file_selector_linux file_selector_macos file_selector_platform_interface file_selector_web file_selector_windows flutter] - file_selector_ios 0.5.1+4 [file_selector_platform_interface flutter] - file_selector_linux 0.9.1+3 [cross_file file_selector_platform_interface flutter] - file_selector_macos 0.9.2 [cross_file file_selector_platform_interface flutter] - file_selector_platform_interface 2.5.0 [cross_file flutter http plugin_platform_interface] - file_selector_web 0.9.0+4 [file_selector_platform_interface flutter flutter_web_plugins] - file_selector_windows 0.9.2 [cross_file file_selector_platform_interface flutter] - firebase_analytics_platform_interface 3.4.1 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_analytics_web 0.5.2+1 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - firebase_auth_platform_interface 6.13.1 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 5.3.2 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js 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_crashlytics_platform_interface 3.4.1 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_messaging_platform_interface 4.3.1 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 3.3.1 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta] - firebase_performance_platform_interface 0.1.2+1 [_flutterfire_internals firebase_core flutter plugin_platform_interface] - firebase_performance_web 0.1.2+1 [_flutterfire_internals firebase_core firebase_core_web firebase_performance_platform_interface flutter flutter_web_plugins js] - firebase_storage_platform_interface 4.2.1 [collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_web 3.4.1 [_flutterfire_internals async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js 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_markdown 0.6.14 [flutter markdown meta path] - flutter_plugin_android_lifecycle 2.0.13 [flutter] - flutter_portal 1.1.3 [collection flutter vector_math] - flutter_spinkit 5.2.0 [flutter] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math] - freezed_annotation 2.2.0 [collection json_annotation meta] - get 4.6.5 [flutter] - html 0.15.3 [csslib source_span] - http 0.13.6 [async http_parser meta] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - image 4.0.16 [archive meta xml] - image_cropper_for_web 1.0.3 [flutter flutter_web_plugins image_cropper_platform_interface js] - image_cropper_platform_interface 3.0.3 [flutter plugin_platform_interface http] - image_gallery_saver 1.7.1 [flutter] - image_picker_android 0.8.6+11 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface] - image_picker_for_web 2.1.12 [flutter flutter_web_plugins image_picker_platform_interface] - image_picker_ios 0.8.7+3 [flutter image_picker_platform_interface] - image_picker_platform_interface 2.6.3 [cross_file flutter http plugin_platform_interface] - intl 0.17.0 [clock path] - jiffy 5.0.0 [intl] - jose 0.3.3 [crypto_keys meta typed_data x509 http http_parser asn1lib collection] - js 0.6.5 [meta] - json_annotation 4.8.1 [meta] - lints 2.0.1 - logger 1.3.0 - logging 1.1.1 - markdown 7.1.0 [args meta] - matcher 0.12.13 [meta stack_trace] - material_color_utilities 0.2.0 - meta 1.8.0 - mime 1.0.4 - nested 1.0.0 [flutter] - nm 0.5.0 [dbus] - octo_image 1.0.2 [flutter flutter_blurhash] - os_detect 2.0.1 - package_info_plus 3.1.2 [ffi flutter flutter_web_plugins http meta path package_info_plus_platform_interface win32] - package_info_plus_platform_interface 2.0.1 [flutter meta plugin_platform_interface] - path 1.8.2 - path_parsing 1.0.1 [vector_math meta] - path_provider 2.0.14 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows] - path_provider_android 2.0.27 [flutter path_provider_platform_interface] - path_provider_foundation 2.2.2 [flutter path_provider_platform_interface] - path_provider_linux 2.1.10 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_platform_interface 2.0.6 [flutter platform plugin_platform_interface] - path_provider_windows 2.1.6 [ffi flutter path path_provider_platform_interface win32] - pedantic 1.11.1 - petitparser 5.1.0 [meta] - photo_manager 2.6.0 [flutter] - photo_view 0.14.0 [flutter] - platform 3.1.0 - plugin_platform_interface 2.1.4 [meta] - pointycastle 3.7.3 [collection convert js] - process 4.2.4 [file path platform] - quiver 3.2.1 [matcher] - rate_limiter 1.0.0 - rxdart 0.27.7 - share_plus 6.3.4 [cross_file meta mime flutter flutter_web_plugins share_plus_platform_interface file url_launcher_web url_launcher_windows url_launcher_linux url_launcher_platform_interface ffi win32] - share_plus_platform_interface 3.2.1 [cross_file flutter meta mime plugin_platform_interface path_provider uuid] - shared_preferences 2.1.0 [flutter shared_preferences_android shared_preferences_foundation shared_preferences_linux shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] - shared_preferences_android 2.1.4 [flutter shared_preferences_platform_interface] - shared_preferences_foundation 2.2.1 [flutter shared_preferences_platform_interface] - shared_preferences_linux 2.2.0 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface] - shared_preferences_platform_interface 2.2.0 [flutter plugin_platform_interface] - shared_preferences_web 2.1.0 [flutter flutter_web_plugins shared_preferences_platform_interface] - shared_preferences_windows 2.2.0 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface] - shimmer 2.0.0 [flutter] - sky_engine 0.0.99 - source_span 1.9.1 [collection path term_glyph] - sqflite 2.2.8+1 [flutter sqflite_common path] - sqflite_common 2.4.5 [synchronized path meta] - stack_trace 1.11.0 [path] - stream_channel 2.1.1 [async] - stream_chat 6.0.0 [async collection dio equatable freezed_annotation http_parser jose json_annotation logging meta mime rate_limiter rxdart uuid web_socket_channel] - stream_chat_flutter_core 6.0.0 [collection connectivity_plus flutter freezed_annotation meta rxdart stream_chat] - string_scanner 1.2.0 [source_span] - synchronized 3.1.0 - 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] - thumblr 0.0.4 [flutter thumblr_platform_interface thumblr_macos thumblr_windows] - thumblr_macos 0.4.0 [flutter thumblr_platform_interface] - thumblr_platform_interface 0.3.1+1 [flutter plugin_platform_interface] - thumblr_windows 0.0.3+1 [flutter thumblr_platform_interface path_provider] - typed_data 1.3.1 [collection] - universal_io 2.2.0 [collection meta typed_data] - url_launcher_android 6.0.31 [flutter url_launcher_platform_interface] - url_launcher_ios 6.1.4 [flutter url_launcher_platform_interface] - url_launcher_linux 3.0.5 [flutter url_launcher_platform_interface] - url_launcher_macos 3.0.5 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.1.2 [flutter plugin_platform_interface] - url_launcher_web 2.0.16 [flutter flutter_web_plugins url_launcher_platform_interface] - url_launcher_windows 3.0.6 [flutter url_launcher_platform_interface] - vector_graphics 1.1.5 [flutter vector_graphics_codec] - vector_graphics_codec 1.1.5 - vector_graphics_compiler 1.1.5 [args meta path_parsing xml vector_graphics_codec] - vector_math 2.1.4 - version 3.0.2 - video_player 2.6.1 [flutter html video_player_android video_player_avfoundation video_player_platform_interface video_player_web] - video_player_android 2.4.7 [flutter video_player_platform_interface] - video_player_avfoundation 2.4.5 [flutter video_player_platform_interface] - video_player_macos 2.0.1 [flutter video_player_platform_interface] - video_player_platform_interface 6.1.0 [flutter plugin_platform_interface] - video_player_web 2.0.16 [flutter flutter_web_plugins video_player_platform_interface] - video_thumbnail 0.5.3 [flutter] - wakelock 0.6.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.1 [flutter wakelock_platform_interface win32] - web_socket_channel 2.4.0 [async crypto stream_channel] - win32 3.1.4 [ffi] - x509 0.2.3 [asn1lib quiver crypto_keys] - xdg_directories 1.0.0 [meta path process] - xml 6.2.2 [collection meta petitparser] - yaml 3.1.2 [collection source_span string_scanner] ```