Closed marc-wilson closed 8 months ago
Probably similar to this: https://github.com/firebase/flutterfire/issues/3916
After lots of sifting through related github issues, i ran into this comment:
https://github.com/firebase/flutterfire/issues/4145#issuecomment-739571979
This would be a much less frequent issue if this was outline in the documentation (assuming it's still the correct answer in 2024).
Hello @marc-wilson, you found the correct answer, using https://pub.dev/packages/flutter_app_badger is still the way of doing it. You can change the badge number using https://firebase.google.com/docs/reference/admin/node/firebase-admin.messaging.androidnotification#androidnotificationnotificationcount on Android.
Bug report
Describe the bug I am testing out push notifications and was able to do so successfully. However, after opening the app, the app badge remains. It will not go away. The documentation makes no mentioning around clearing the notification count so I assume this is automatic an automatic thing. If this isn't an automatic thing and I need to do so with code, I am not finding any documentation around how to achieve that.
I have read that all I need to do is send another campaign where the badge count is set to 0. But, our app is already live and I don't want to blast a bunch of people with another test campaign just to clear an app badge on a few devices. If that's the only way, that's fine. I just want to know the proper process of clearing the notification badge.
I have tried:
Steps to reproduce
Expected behavior
After opening the notifications and/or app, the notifications should go away.
Sample project
Providing a minimal example project which demonstrates the bug in isolation from your main App greatly enhances the chance of a timely fix. Please link to the public repository URL.
Additional context
This is on iOS only. A physical device. Not a simulator.
I created a campaign and sent out a test with a badge count. Now it never goes away.
What is the process involved in clearing/marking the notifications as "read"? Is this platform-specific? Do I have to manually mark things as read or is this automatic?
Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
``` [✓] Flutter (Channel stable, 3.19.2, on macOS 14.3.1 23D60 darwin-arm64, locale en-US) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.3) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.2) [✓] IntelliJ IDEA Ultimate Edition (version 2023.3.4) [✓] VS Code (version 1.87.0) [✓] Connected device (3 available) [✓] Network resources ```Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
``` Dart SDK 3.3.0 Flutter SDK 3.19.2 headset_app 1.0.3+1 dependencies: - app_tracking_transparency 2.0.4 [flutter] - auth0_flutter 1.5.0 [auth0_flutter_platform_interface flutter flutter_web_plugins js] - change_app_package_name 1.1.0 - cupertino_icons 1.0.6 - datadog_flutter_plugin 2.2.0 [flutter flutter_web_plugins js plugin_platform_interface json_annotation uuid meta] - datadog_tracking_http_client 2.1.0 [flutter datadog_flutter_plugin uuid http] - dio 5.4.0 [async http_parser meta path] - firebase_core 2.25.3 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_crashlytics 3.4.13 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace] - firebase_messaging 14.7.14 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - fl_chart 0.66.1 [equatable flutter] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine] - flutter_svg 2.0.9 [flutter vector_graphics vector_graphics_codec vector_graphics_compiler] - flutter_widget_from_html 0.14.11 [flutter flutter_widget_from_html_core fwfh_cached_network_image fwfh_chewie fwfh_just_audio fwfh_svg fwfh_url_launcher fwfh_webview html] - get_it 7.6.7 [async collection] - graphql 5.2.0-beta.7 [meta path gql gql_exec gql_link gql_http_link gql_transform_link gql_error_link gql_dedupe_link hive normalize http collection web_socket_channel stream_channel rxdart uuid] - http 1.2.0 [async http_parser meta web] - intl 0.19.0 [clock meta path] - mixpanel_flutter 2.2.0 [flutter flutter_web_plugins js] - provider 6.1.1 [collection flutter nested] - url_launcher 6.2.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_lints 3.0.1 [lints] - flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math leak_tracker_flutter_testing async boolean_selector characters collection leak_tracker leak_tracker_testing material_color_utilities meta source_span stream_channel string_scanner term_glyph vm_service] transitive dependencies: - _flutterfire_internals 1.3.20 [collection firebase_core firebase_core_platform_interface flutter meta] - args 2.4.2 - async 2.11.0 [collection meta] - audio_session 0.1.18 [flutter flutter_web_plugins rxdart meta] - auth0_flutter_platform_interface 1.5.0 [flutter plugin_platform_interface] - boolean_selector 2.1.1 [source_span string_scanner] - cached_network_image 3.3.1 [cached_network_image_platform_interface cached_network_image_web flutter flutter_cache_manager octo_image] - cached_network_image_platform_interface 4.0.0 [flutter flutter_cache_manager] - cached_network_image_web 1.1.1 [cached_network_image_platform_interface flutter flutter_cache_manager] - characters 1.3.0 - chewie 1.7.4 [cupertino_icons flutter provider video_player wakelock_plus] - clock 1.1.1 - collection 1.18.0 - crypto 3.0.3 [typed_data] - csslib 1.0.0 [source_span] - dbus 0.7.10 [args ffi meta xml] - equatable 2.0.5 [collection meta] - fake_async 1.3.1 [clock collection] - ffi 2.1.0 - file 7.0.0 [meta path] - firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.11.3 [firebase_core_platform_interface flutter flutter_web_plugins js meta web] - firebase_crashlytics_platform_interface 3.6.20 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_messaging_platform_interface 4.5.22 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 3.6.3 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta web] - fixnum 1.1.0 - flutter_cache_manager 3.3.1 [clock collection file flutter http path path_provider rxdart sqflite uuid] - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math] - flutter_widget_from_html_core 0.14.11 [csslib flutter html logging] - fwfh_cached_network_image 0.14.2 [cached_network_image flutter flutter_cache_manager flutter_widget_from_html_core] - fwfh_chewie 0.14.7 [chewie flutter flutter_widget_from_html_core video_player] - fwfh_just_audio 0.14.2 [flutter flutter_widget_from_html_core just_audio] - fwfh_svg 0.8.1 [flutter flutter_svg flutter_widget_from_html_core] - fwfh_url_launcher 0.9.0+4 [flutter flutter_widget_from_html_core url_launcher] - fwfh_webview 0.14.8 [flutter flutter_widget_from_html_core logging webview_flutter webview_flutter_android webview_flutter_wkwebview] - gql 1.0.1-alpha+1706372327764 [collection meta source_span yaml] - gql_dedupe_link 2.0.4-alpha+1705114623057 [async gql_exec gql_link meta] - gql_error_link 1.0.0+1 [async gql_exec gql_link meta] - gql_exec 1.1.1-alpha+1699813812660 [collection gql meta] - gql_http_link 1.0.1+1 [gql gql_exec gql_link http http_parser meta] - gql_link 1.0.1-alpha+1706372327781 [gql gql_exec meta] - gql_transform_link 1.0.0 [gql_exec gql_link] - hive 2.2.3 [meta crypto] - html 0.15.4 [csslib source_span] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - js 0.6.7 [meta] - json_annotation 4.8.1 [meta] - just_audio 0.9.36 [just_audio_platform_interface just_audio_web audio_session rxdart path path_provider async uuid crypto meta flutter] - just_audio_platform_interface 4.2.2 [flutter plugin_platform_interface] - just_audio_web 0.4.9 [just_audio_platform_interface flutter flutter_web_plugins] - leak_tracker 10.0.0 [clock collection meta path vm_service] - leak_tracker_flutter_testing 2.0.1 [flutter leak_tracker leak_tracker_testing matcher meta] - leak_tracker_testing 2.0.1 [leak_tracker matcher meta] - lints 3.0.0 - logging 1.2.0 - matcher 0.12.16+1 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.8.0 [collection] - meta 1.11.0 - nested 1.0.0 [flutter] - normalize 0.8.2+1 [gql collection] - octo_image 2.0.0 [flutter] - package_info_plus 5.0.1 [ffi flutter flutter_web_plugins http meta path package_info_plus_platform_interface web win32] - package_info_plus_platform_interface 2.0.1 [flutter meta plugin_platform_interface] - path 1.9.0 - path_parsing 1.0.1 [vector_math meta] - path_provider 2.1.2 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows] - path_provider_android 2.2.2 [flutter path_provider_platform_interface] - path_provider_foundation 2.3.2 [flutter path_provider_platform_interface] - path_provider_linux 2.2.1 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_platform_interface 2.1.2 [flutter platform plugin_platform_interface] - path_provider_windows 2.2.1 [ffi flutter path path_provider_platform_interface win32] - petitparser 6.0.2 [meta] - platform 3.1.4 - plugin_platform_interface 2.1.8 [meta] - rxdart 0.27.7 - sky_engine 0.0.99 - source_span 1.10.0 [collection path term_glyph] - sprintf 7.0.0 - sqflite 2.3.2 [flutter sqflite_common path] - sqflite_common 2.5.3 [synchronized path meta] - stack_trace 1.11.1 [path] - stream_channel 2.1.2 [async] - string_scanner 1.2.0 [source_span] - synchronized 3.1.0+1 - term_glyph 1.2.1 - test_api 0.6.1 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph] - typed_data 1.3.2 [collection] - url_launcher_android 6.2.2 [flutter url_launcher_platform_interface] - url_launcher_ios 6.2.4 [flutter url_launcher_platform_interface] - url_launcher_linux 3.1.1 [flutter url_launcher_platform_interface] - url_launcher_macos 3.1.0 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.3.1 [flutter plugin_platform_interface] - url_launcher_web 2.2.3 [flutter flutter_web_plugins url_launcher_platform_interface web] - url_launcher_windows 3.1.1 [flutter url_launcher_platform_interface] - uuid 4.3.3 [crypto sprintf meta fixnum] - vector_graphics 1.1.9+2 [flutter vector_graphics_codec] - vector_graphics_codec 1.1.9+2 - vector_graphics_compiler 1.1.9+2 [args meta path_parsing xml vector_graphics_codec path] - vector_math 2.1.4 - video_player 2.8.2 [flutter html video_player_android video_player_avfoundation video_player_platform_interface video_player_web] - video_player_android 2.4.11 [flutter video_player_platform_interface] - video_player_avfoundation 2.5.6 [flutter video_player_platform_interface] - video_player_platform_interface 6.2.2 [flutter plugin_platform_interface] - video_player_web 2.1.3 [flutter flutter_web_plugins video_player_platform_interface] - vm_service 13.0.0 - wakelock_plus 1.1.4 [flutter flutter_web_plugins meta wakelock_plus_platform_interface win32 dbus package_info_plus js] - wakelock_plus_platform_interface 1.1.0 [flutter plugin_platform_interface meta] - web 0.3.0 - web_socket_channel 2.4.0 [async crypto stream_channel] - webview_flutter 4.5.0 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview] - webview_flutter_android 3.14.0 [flutter webview_flutter_platform_interface] - webview_flutter_platform_interface 2.10.0 [flutter meta plugin_platform_interface] - webview_flutter_wkwebview 3.11.0 [flutter path webview_flutter_platform_interface] - win32 5.2.0 [ffi] - xdg_directories 1.0.4 [meta path] - xml 6.5.0 [collection meta petitparser] - yaml 3.1.2 [collection source_span string_scanner] ```