Skip to content

🐛 [firebase_messaging] When tapping app icon with pending notification, data is never received by the app #3979

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
jlubeck opened this issue Oct 28, 2020 · 1 comment · Fixed by #4012
Labels
plugin: messaging type: bug Something isn't working

Comments

@jlubeck
Copy link

jlubeck commented Oct 28, 2020

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

@jlubeck jlubeck added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Oct 28, 2020
@markusaksli-nc
Copy link
Contributor

Reproducible on the latest flutter master 1.24.0-4.0.pre.138 with firebase_messaging: ^7.0.3.

flutter doctor -v
[√] Flutter (Channel master, 1.24.0-4.0.pre.138, on Microsoft Windows [Version 10.0.19041.572], locale en-US)
    • Flutter version 1.24.0-4.0.pre.138 at C:\Development\flutter_master
    • Framework revision 13896b3bd1 (4 hours ago), 2020-10-28 19:43:19 -0700
    • Engine revision 073263e39d
    • Dart version 2.11.0 (build 2.11.0-260.0.dev)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at C:\Users\marku\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\201.6858069\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.6.5)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.6.30320.27
    • Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 4.1.0)
    • Android Studio at C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\201.6858069
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] IntelliJ IDEA Ultimate Edition (version 2020.3)
    • IntelliJ at C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\203.5251.39
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] Connected device (6 available)
    • SM G950F (mobile)           • ce12171c51cc001c03 • android-arm64  • Android 9 (API 28)
    • sdk gphone x86 arm (mobile) • emulator-5554      • android-x86    • Android 11 (API 30) (emulator)
    • Windows (desktop)           • windows            • windows-x64    • Microsoft Windows [Version 10.0.19041.572]
    • Web Server (web)            • web-server         • web-javascript • Flutter Tools
    • Chrome (web)                • chrome             • web-javascript • Google Chrome 86.0.4240.111
    • Edge (web)                  • edge               • web-javascript • Microsoft Edge 86.0.622.51

• No issues found!

@markusaksli-nc markusaksli-nc added plugin: messaging and removed Needs Attention This issue needs maintainer attention. labels Oct 29, 2020
@firebase firebase locked and limited conversation to collaborators Dec 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plugin: messaging type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants