Description
Bug report
Describe the bug
There was a ticket for this already here: #553 but it was closed without been fixed.
When you get a new notification on Android, you get it both to the notification center and also the icon gets a badge with a number.
It is expected that when you tap on either the notification or the icon itself, to get the notification's data. You currently don't get anything when tapping on the icon, only when tapping on the notification.
Furthermore, the notification is not cleared when tapping on the icon.
That piece itself can be solved by changing the MainActivity
class to add this on onCreate
:
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancelAll();
This clears the notification, but now you lost the notification data forever.
Additional context
Besides the main issue, it would also be nice to be able to clear notifications within Flutter, and not having to mess with native Android code.
Flutter doctor
Run flutter doctor
and paste the output below:
Click To Expand
[✓] Flutter (Channel dev, 1.24.0-1.0.pre, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.50.1)
[✓] Connected device (6 available)
Flutter dependencies
Run flutter pub deps -- --style=compact
and paste the output below:
Click To Expand
Dart SDK 2.11.0-218.0.dev
Flutter SDK 1.24.0-1.0.pre
safepass 1.2.2+30
dependencies:
- app_settings 4.0.0 [flutter]
- barcode_scan 3.0.1 [protobuf flutter]
- cupertino_icons 0.1.3
- device_apps 1.1.0 [flutter]
- dragonchain_sdk 0.0.3 [flutter flutter_secure_storage http crypto logger universal_io]
- factor_flutter_components 1.1.0 [flutter flutter_secure_storage flutter_svg http universal_io dragonfactor_sdk shared_preferences sqfentity sqfentity_gen fluttertoast cupertino_icons]
- firebase_analytics 6.0.0 [meta flutter firebase_core firebase_analytics_web firebase_analytics_platform_interface]
- firebase_auth 0.18.0+1 [meta firebase_core firebase_core_platform_interface firebase_auth_platform_interface firebase_auth_web flutter]
- firebase_core 0.5.0 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- firebase_crashlytics 0.1.4+1 [flutter stack_trace]
- firebase_messaging 7.0.0 [meta platform flutter firebase_core]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_localizations 0.0.0 [flutter intl characters collection meta path typed_data vector_math]
- flutter_platform_widgets 0.32.5 [flutter]
- flutter_secure_storage 3.3.3 [meta flutter]
- font_awesome_flutter 8.8.1 [flutter]
- geolocator 5.3.1 [flutter meta equatable google_api_availability location_permissions vector_math]
- get 3.13.2 [flutter]
- google_maps_flutter 0.5.27+1 [flutter flutter_plugin_android_lifecycle google_maps_flutter_platform_interface]
- image_picker 0.6.6+1 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
- intl 0.16.1 [path]
- location 3.0.2 [flutter meta location_platform_interface location_web]
- notification_permissions 0.4.4 [flutter]
- package_info 0.4.0+17 [flutter]
- path_provider 1.6.7 [flutter path_provider_platform_interface path_provider_macos]
- pin_code_text_field 1.7.1 [flutter]
- provider 4.0.5+1 [flutter nested collection]
- qr_flutter 3.2.0 [flutter qr]
- shared_preferences 0.5.10 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web]
- universal_io 1.0.1 [meta zone_local]
- url_launcher 5.4.5 [flutter url_launcher_platform_interface url_launcher_web url_launcher_macos]
- uuid 2.0.4 [crypto convert]
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 meta source_span stream_channel string_scanner term_glyph typed_data]
dependency overrides:
- flutter_svg 0.18.1 [path_drawing xml vector_math meta flutter]
transitive dependencies:
- _fe_analyzer_shared 7.0.0 [meta]
- analyzer 0.39.17 [_fe_analyzer_shared args charcode cli_util collection convert crypto glob html meta package_config path pub_semver source_span watcher yaml]
- args 1.6.0
- async 2.5.0-nullsafety.1 [collection]
- base58check 1.0.1 [crypto collection]
- boolean_selector 2.1.0-nullsafety.1 [source_span string_scanner]
- build 1.3.0 [analyzer async convert crypto logging meta path glob]
- build_config 0.4.2 [checked_yaml json_annotation meta path pubspec_parse yaml]
- characters 1.1.0-nullsafety.3
- charcode 1.2.0-nullsafety.1
- checked_yaml 1.0.2 [json_annotation source_span yaml]
- cli_util 0.2.0 [path]
- clock 1.1.0-nullsafety.1
- collection 1.15.0-nullsafety.3
- convert 2.1.1 [charcode typed_data]
- crypto 2.1.4 [collection convert typed_data]
- csslib 0.16.2 [source_span]
- dart_style 1.3.6 [analyzer args path source_span]
- dragonfactor_sdk 1.0.0+1 [logger convert pointycastle base58check json_serializable universal_io]
- equatable 1.1.1 [collection meta]
- fake_async 1.2.0-nullsafety.1 [clock collection]
- ffi 0.1.3
- file 5.2.1 [intl meta path]
- firebase 7.3.0 [http http_parser js]
- firebase_analytics_platform_interface 1.0.3 [flutter meta]
- firebase_analytics_web 0.1.1 [flutter flutter_web_plugins firebase firebase_analytics_platform_interface meta]
- firebase_auth_platform_interface 2.0.1 [flutter meta firebase_core plugin_platform_interface]
- firebase_auth_web 0.3.0+1 [flutter flutter_web_plugins firebase meta http_parser intl firebase_core firebase_auth_platform_interface js]
- firebase_core_platform_interface 2.0.0 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.0 [firebase firebase_core_platform_interface flutter flutter_web_plugins meta js]
- fixnum 0.10.11
- flutter_plugin_android_lifecycle 1.0.7 [flutter]
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- fluttertoast 4.0.1 [flutter flutter_web_plugins]
- glob 1.2.0 [async collection node_io path pedantic string_scanner]
- google_api_availability 2.0.4 [flutter]
- google_maps_flutter_platform_interface 1.0.1 [flutter meta plugin_platform_interface stream_transform]
- html 0.14.0+3 [csslib source_span]
- http 0.12.1 [http_parser path pedantic]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- image_picker_platform_interface 1.0.0 [flutter meta plugin_platform_interface]
- js 0.6.3-nullsafety.1
- json_annotation 3.0.1
- json_serializable 3.4.0 [analyzer build build_config json_annotation meta path source_gen]
- location_permissions 2.0.5 [flutter meta]
- location_platform_interface 1.0.0 [flutter meta plugin_platform_interface]
- location_web 1.0.0 [flutter flutter_web_plugins location_platform_interface http_parser meta js]
- logger 0.7.0+2
- logging 0.11.4
- matcher 0.12.10-nullsafety.1 [stack_trace]
- meta 1.3.0-nullsafety.4
- nested 0.0.4 [flutter]
- node_interop 1.1.1 [js]
- node_io 1.1.1 [node_interop path]
- package_config 1.9.3 [path charcode]
- path 1.8.0-nullsafety.1
- path_drawing 0.4.1+1 [vector_math meta path_parsing flutter]
- path_parsing 0.1.4 [vector_math meta]
- path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter]
- path_provider_macos 0.0.4+2 [flutter]
- path_provider_platform_interface 1.0.1 [flutter meta platform plugin_platform_interface]
- pedantic 1.9.0
- petitparser 3.1.0 [meta]
- platform 2.2.1
- plugin_platform_interface 1.0.2 [meta]
- pointycastle 1.0.2
- process 3.0.13 [file intl meta path platform]
- protobuf 1.0.1 [fixnum]
- pub_semver 1.4.4 [collection]
- pubspec_parse 0.1.5 [checked_yaml json_annotation pub_semver yaml]
- qr 1.2.0 [meta]
- quiver 2.1.3 [matcher meta]
- shared_preferences_linux 0.0.2+2 [file flutter meta path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 0.0.1+8 [shared_preferences_platform_interface flutter]
- shared_preferences_platform_interface 1.0.3 [meta flutter]
- shared_preferences_web 0.1.2+5 [shared_preferences_platform_interface flutter flutter_web_plugins meta]
- sky_engine 0.0.99
- source_gen 0.9.6 [analyzer async build dart_style glob meta path pedantic source_span]
- source_span 1.8.0-nullsafety.2 [charcode collection path term_glyph]
- sqfentity 1.4.0+1 [flutter sqflite synchronized path sqfentity_gen sqflite_common_ffi]
- sqfentity_gen 1.4.0 [build source_gen]
- sqflite 1.3.1+1 [flutter sqflite_common path]
- sqflite_common 1.0.2+1 [synchronized path meta]
- sqflite_common_ffi 1.1.0+1 [sqlite3 sqflite_common synchronized path meta]
- sqlite3 0.1.4 [collection ffi meta]
- stack_trace 1.10.0-nullsafety.2 [path]
- stream_channel 2.1.0-nullsafety.1 [async]
- stream_transform 1.2.0
- string_scanner 1.1.0-nullsafety.1 [charcode source_span]
- synchronized 2.2.0+2
- term_glyph 1.2.0-nullsafety.1
- test_api 0.2.19-nullsafety.2 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.0-nullsafety.3 [collection]
- url_launcher_macos 0.0.1+5 [flutter]
- url_launcher_platform_interface 1.0.6 [flutter meta plugin_platform_interface]
- url_launcher_web 0.1.1+4 [url_launcher_platform_interface flutter flutter_web_plugins meta js]
- vector_math 2.1.0-nullsafety.3
- watcher 0.9.7+15 [async path pedantic]
- xdg_directories 0.1.2 [meta path process]
- xml 4.4.1 [collection convert meta petitparser]
- yaml 2.2.1 [charcode collection string_scanner source_span]
- zone_local 0.1.2