flutter_workmanager
flutter_workmanager copied to clipboard
[Android] can't start task without seeing any error message
- [x] I have read the README
- [x] I have done the setup for Android
- [ ] I have done the setup for iOS
- [ ] I have ran the sample app and it does not work there
- [x] The sample app is working for me
Version
| Technology | Version |
|---|---|
| Workmanager version | 0.5.1 |
| Xcode version | not use |
| Swift version | not use |
| iOS deployment target | not use |
Describe the error Sometimes the task can't be started, there's no error catched, no way to know what's wrong and have to guess. Last time I encounted this situation is because I set requiresStorageNotLow: true and requiresBatteryNotLow: true, I have to set them to false( which does not make sense to me) to make it work. This time, I was trying to start a one time task from a function inside a periodic task, no respond again. Hopefully you can provide a list of reasons that may lead to this situation, being able to output some error message would be better.
Optionally provide the least amount of code that shows this behaviour. Ideally in the sample app.
Output of flutter doctor -v
[√] Flutter (Channel stable, 3.10.6, on Microsoft Windows [版本 10.0.19045.3208], locale zh-CN)
• Flutter version 3.10.6 on channel stable at e:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f468f3366c (2 weeks ago), 2023-07-12 15:19:05 -0700
• Engine revision cdbeda788a
• Dart version 3.0.6
• DevTools version 2.23.1
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at e:\Android\sdk • Platform android-33, build-tools 33.0.0 • Java binary at: E:\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted.
[√] Android Studio (version 2021.3) • Android Studio at E:\Android\Android Studio • 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.13+0-b1751.21-8125866)
[√] VS Code (version 1.80.2) • VS Code at C:\Users\wxzzz\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.68.0
[√] Proxy Configuration • HTTP_PROXY is set • NO_PROXY is localhost,127.0.0.1,::1 • NO_PROXY contains localhost • NO_PROXY contains ::1 • NO_PROXY contains 127.0.0.1
[√] Connected device (1 available) • HTC M8d (mobile) • HT43HSF04122 • android-arm • Android 6.0 (API 23)
[√] Network resources • All expected network resources are available.
• No issues found!
Indeed, the only way to check if the job was properly scheduled is by running a debug session. But that only provides the result of the work which is success or failure in the debug console.
In the release builds, even that information is not available. So if the job failed, the user can never know if it was actually scheduled or failed.
Ultimately it is up to the operating system to decide when (or if at all) to run a background task.
Ultimately it is up to the operating system to decide when (or if at all) to run a background task.
Even if the user tries to register a periodic job for the first time?
It might be true for scheduled tasks that are already registered. But in the case of first time, could it not report some bool value in cases
-
where the job was successfully registered, returns true
-
where the job failed to register, returns false