flutter_workmanager
flutter_workmanager copied to clipboard
🐞[Android] Debug notifications can't be disabled
- [x] I have read the README
- [x] I have done the setup for Android
- [x] I have done the setup for iOS
- [x] I have ran the sample app and it does not work there
Version
Technology | Version |
---|---|
Workmanager version | ^0.5.0 |
Xcode version | |
Swift version | |
iOS deployment target |
Describe the error
I've been working on an app for some time now and ready to push it to release.
I started deploying it to beta testers and for some reason the debug notification shows up on every one of their phones.
Same thing happens to me while running the app in release mode
This is my code
TaskScheduler() {
Workmanager().initialize(
// The top level function, aka callbackDispatcher
taskActions,
// isInDebugMode: false // false by default, even if set manually doesn't help
);
}
After pushing an update with isInDebugMode: false
it still shows the notification.
Output of flutter doctor -v
[✓] Flutter (Channel stable, 3.3.5, on macOS 12.6 21G115 darwin-arm, locale en-IL)
• Flutter version 3.3.5 on channel stable at /Users/tomerrosenfeld/Programs/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision d9111f6402 (8 days ago), 2022-10-19 12:27:13 -0700
• Engine revision 3ad69d7be3
• Dart version 2.18.2
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/tomerrosenfeld/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• ANDROID_SDK_ROOT = /Users/tomerrosenfeld/Library/Android/sdk
• Java binary at: /Users/tomerrosenfeld/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7784292/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 13F100
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Users/tomerrosenfeld/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7784292/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 11.0.10+0-b96-7249189)
[✓] VS Code (version 1.71.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.6 21G115 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 106.0.5249.119
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
I found that workmanager
is initialized once. So in order to disable debug mode you should clear data and start app with isInDebugMode
false or just remove it (and it will pickup default value, which is false
as you mentioned). Works fine for me with this scenario with 0.5.1 workmanager.
I am considering to drop debug mode - or have it considerably redone. It currently forces users of this library into declaring POST_NOTIFICATION permissions on Android and realistically is code that should never land in production apps.
I got the same issue, even in the production the notifications want to be disabled, worse experience with this plugin, considering not using this anymore.
For future devs be careful before using this plugin.