[Bug]: ForegroundNotificationConfig.setOngoing has no effect, notification can be dismissed
Please check the following before submitting a new issue.
- [X] I have searched the existing issues.
- [X] I have carefully read the documentation and verified I have added the required platform specific configuration.
Please select affected platform(s)
- [X] Android
- [ ] iOS
- [ ] Linux
- [ ] macOS
- [ ] Web
- [ ] Windows
Steps to reproduce
- Set
AndroidSettings.ForegroundNotificationConfig.setOngoing = true - Start a foreground service using
getPositionStream() - The service notification will appear as expected
- Try swiping left/right on the notification
Expected results
The notification can't be dismissed.
Actual results
The notification is dismissed / dissapears.
Code sample
Code sample
[Paste your code here]
Screenshots or video
Screenshots or video demonstration
[Upload media here]
Version
12.0.0
Flutter Doctor output
Doctor output
flutter doctor -v
[✓] Flutter (Channel stable, 3.24.0, on macOS 14.6.1 23G93 darwin-arm64, locale en-US)
• Flutter version 3.24.0 on channel stable at /Users/orkun/git/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 80c2e84975 (3 weeks ago), 2024-07-30 23:06:49 +0700
• Engine revision b8800d88be
• Dart version 3.5.0
• DevTools version 2.37.2
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at /Users/orkun/Library/Android/sdk
• Platform android-35, build-tools 35.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.1)
• Android Studio at /Applications/Android Studio.app/Contents
• 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 17.0.11+0-17.0.11b1207.24-11852314)
[✓] VS Code (version 1.92.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.94.0
[✓] Connected device (4 available)
----
[✓] Network resources
• All expected network resources are available.
• No issues found!```
</details>
Dear @orkun1675,
On what Android version are you testing this? Does this also happen on the supplied example app?
Kind regards,
Hi Tim!
I am testing on a Pixel 8 Pro emulator that is running Android 35.
I was able to replicate the issue using the example app: source
Hmm, it looks like Android no longer supports ongoing notifications after v34: https://developer.android.com/about/versions/14/behavior-changes-all#non-dismissable-notifications
What a bummer. Unfortunately neither the NotificationCompat.Builder or the Foreground services documentation mentions this.
I wonder if dimissing the notification kills the foreground service?
Hi, I saw that deleting the notification did not kill the service.