Hello,
With firebase_messaging plugin, after receiving the notification if you open the app directly, instead of tapping on the notification (in a tray), the notification will stay there.
If you tap on the notification it will clear itself.
I was hoping that there would be a method to clear a system tray notification (or it will do it automatically).
firebase_messaging: ^2.1.0
flutter doctor -v.
[โ] Flutter (Channel master, v1.0.1-pre.1, on Mac OS X 10.13.6 17G65, locale en-US)
โข Flutter version 1.0.1-pre.1 at /Users/user/flutter
โข Framework revision a226c0f0d9 (5 days ago), 2018-11-30 16:18:18 -0800
โข Engine revision 7375a0f414
โข Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[โ] Android toolchain - develop for Android devices (Android SDK 28.0.3)
โข Android SDK at /Users/user/Library/Android/sdk
โข Android NDK location not configured (optional; useful for native profiling support)
โข Platform android-28, build-tools 28.0.3
โข ANDROID_HOME = /Users/user/Library/Android/sdk
โข Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
โข Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
โข All Android licenses accepted.
[โ] iOS toolchain - develop for iOS devices (Xcode 10.1)
โข Xcode at /Applications/Xcode.app/Contents/Developer
โข Xcode 10.1, Build version 10B61
โข ios-deploy 1.9.4
โข CocoaPods version 1.5.3
[โ] Android Studio (version 3.1)
โข Android Studio at /Applications/Android Studio.app/Contents
โข Flutter plugin version 29.0.1
โข Dart plugin version 173.4700
โข Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[โ] VS Code (version 1.29.1)
โข VS Code at /Applications/Visual Studio Code.app/Contents
โข Flutter extension version 2.21.1
[โ] Connected device (2 available)
โข Pixel 3 โข XXXXXXXXXX โข android-arm64 โข Android 9 (API 28)
โข Android SDK built for x86 โข emulator-5554 โข android-x86 โข Android 8.1.0 (API 27) (emulator)
@arsen
The issue at https://github.com/flutter/flutter/issues/25030 has been closed and moved here. Future collaboration on this issue will be done here.
Hi @arsen
If you are still experiencing this issue
with the latest version of Flutter and FlutterFire plugin
can you please provide your updated flutter doctor -v
and your and your flutter run --verbose/flutter build --verbose ?
Also, to better address the issue, would be helpful
if you could post a self contained app on github
or the steps to reproduce it.
Thank you
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.
Could everyone who still has this problem please file a new issue with the exact descriptions what happens, logs and the output of 'flutter doctor -v' please.
All system setups can be slightly different so its always better to open new issues and reference related issues.
I have this issue too. If I open the App directly from the App icon, the notification is not received. The notification is only received and removed when taped on the system tray.
flutter doctor -v
[โ] Flutter (Channel master, v1.18.0-6.0.pre.35, on Linux, locale en_US.UTF-8)
โข Flutter version 1.18.0-6.0.pre.35 at /home/mnesarco/devel2-tools/flutter/current
โข Framework revision c97f61a452 (24 hours ago), 2020-04-15 13:12:14 -0700
โข Engine revision deef2663ac
โข Dart version 2.8.0 (build 2.8.0-dev.20.0 c9710e5059)
[โ] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
โข Android SDK at /home/mnesarco/devel2-tools/android
โข Platform android-29, build-tools 29.0.1
โข Java binary at: /home/mnesarco/devel2-tools/ides/android-studio/jre/bin/java
โข Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
โข All Android licenses accepted.
[โ] Android Studio (version 3.6)
โข Android Studio at /home/mnesarco/devel2-tools/ides/android-studio
โข Flutter plugin version 44.0.2
โข Dart plugin version 192.7761
โข Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[โ] Connected device (1 available)
โข SM J610G โข b45e07f9 โข android-arm โข Android 9 (API 28)
โข No issues found!
flutter run --verbose output is massive but says nothing important, when the app is opened directly, nothing happens, onMessage, onLaunch, onResume not called and the notification is still in system tray. But if i tap the notification, everything works as expected: onResume/onLaunch called and the notification is removed.
@mnesarco I resolved this issue on Android with adding these lines to onCreate method in MainActivity class, and on iOS should be similiar.
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancelAll();
Import notification manager from; import android.app.NotificationManager;
@furkansarihan This is not a solution because the notification data never arrives to the app. This just eliminates the notification silently.
The expected behaviour is that if the user open the app directly, the onLaunch or onResume must be called with the data of the pending notifications.
@furkansarihan It will lose other notifications data if we launch the app with one notification.
@iapicca I think this issue is not fixed in any way
Could everyone who still has this problem please file a new issue with the exact descriptions what happens, logs and the output of 'flutter doctor -v' please.
All system setups can be slightly different so its always better to open new issues and reference related issues.
I think it is wanted to have a solution to clear active notifications and get their informations.
flutter doctor -v
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ A new version of Flutter is available! โ
โ โ
โ To update to the latest version, run "flutter upgrade". โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[โ] Flutter (Channel beta, v1.15.17, on Mac OS X 10.15.4 19E266, locale tr-TR)
โข Flutter version 1.15.17 at /Users/*****/flutter
โข Framework revision 2294d75bfa (9 weeks ago), 2020-03-07 00:28:38 +0900
โข Engine revision 5aff311948
โข Dart version 2.8.0 (build 2.8.0-dev.12.0 9983424a3c)
[โ] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
โข Android SDK at /Users/bahadiraksoy/Library/Android/sdk
โข Android NDK location not configured (optional; useful for native profiling support)
โข Platform android-29, build-tools 28.0.3
โข Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
โข Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
โข All Android licenses accepted.
[โ] Xcode - develop for iOS and macOS (Xcode 11.4)
โข Xcode at /Applications/Xcode.app/Contents/Developer
โข Xcode 11.4, Build version 11E146
โข CocoaPods version 1.9.1
[โ] Chrome - develop for the web
โข Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[โ] Android Studio (version 3.5)
โข Android Studio at /Applications/Android Studio.app/Contents
โข Flutter plugin version 44.0.1
โข Dart plugin version 191.8593
โข Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[โ] VS Code (version 1.45.0)
โข VS Code at /Applications/Visual Studio Code.app/Contents
โข Flutter extension version 3.10.1
[โ] Connected device (2 available)
โข Chrome โข chrome โข web-javascript โข Google Chrome 81.0.4044.138
โข Web Server โข web-server โข web-javascript โข Flutter Tools
โข No issues found!
Most helpful comment
@furkansarihan This is not a solution because the notification data never arrives to the app. This just eliminates the notification silently.
The expected behaviour is that if the user open the app directly, the onLaunch or onResume must be called with the data of the pending notifications.