Open
Description
Technology | Version |
---|---|
Workmanager version | main branch |
Xcode version | - |
Swift version | - |
iOS deployment target | - |
Describe the error
Note: I'm using this plugin's main branch.
When I invoke 'registerPeriodicTask' with initDelay and frequency durations stated I expect the callback to get called after initDelay duration from now, then gets called again in frequency.
Problem: initDelay was completely ignored and the first periodic task runs after stated frequency duration. It's weird because before I swapped to this branch, it works just fine.
Bumping back to the official pubspec version won't solve my issue because there's #588 .
Sample Code
static Future testRunPeriodic() async {
await Workmanager().registerPeriodicTask(
"peridicChicken",
"periodicChickenName",
initialDelay: const Duration(minutes: 2),
frequency: const Duration(minutes: 15),
inputData: {
"isTest": true,
},
);
}
We can see that initDelay is set to 2 minutes, but the callback gets invoked in 15 minutes instead.
Activity
Manuito83 commentedon Apr 2, 2025
@BigYajuu I saw the same and I've been doing some tests. I think this is not this package's fault, but instead a consequence of upgrading the native WorkManager version as per this line here that bumps it v2.9.0:
flutter_workmanager/workmanager/android/build.gradle
Line 45 in 4ce0651
I tried downgrading to WorkManager 2.7.1, which is the version that
flutter_workmanager
v0.5.2 was using, and I think it has reverted the issue.android/app/build.gradle
I haven't tried upgrading (to 2.10.0), instead of downgrading, but it would be interesting to try. I'm not sure if this is something that is broken as well in the native WorkManager... or, instead (which would be bad news) something they have decided to patch so that there's no way around the 15 minutes limitation.