flutter_workmanager icon indicating copy to clipboard operation
flutter_workmanager copied to clipboard

Periodic Task not triggering immediately

Open devroble opened this issue 4 months ago • 1 comments

I'm encountering the same issue on Android like @salarazad. In my case, the task triggers after the set frequency, but it doesn't run immediately as it did in the previous version, if the initialDelay is set to 10s.

I also tried the fork and it worked well for me. Using this fork, I updated the native workmanager dependency to version 2.9.1 (the same version used in 0.6.0), and it worked as expected. I also tested with the latest version 2.10.1, and it still worked. I used the example app to test it.

To update the dependency, I used the following configuration in build.gradle:

configurations.all {
    resolutionStrategy.eachDependency { details ->
        if (details.requested.group == 'androidx.work' && 
            (details.requested.name == 'work-runtime' || details.requested.name == 'work-runtime-ktx')) {
            details.useVersion '2.9.1'
        }
    }
}

In my opinion, there might be a bug in the workmanager plugin itself, since everything works correctly when using the fork or manually managing the native dependency version.

My flutter doctor:

[√] Flutter (Channel stable, 3.32.2, on Microsoft Windows [Version 10.0.26100.4061], locale de-DE)
[√] Windows Version (11 Business 64-bit, 24H2, 2009)
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
[√] Chrome - develop for the web
[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2024.2)
[√] Android Studio (version 2024.3.2)
[√] IntelliJ IDEA Community Edition (version 2024.3)
[√] IntelliJ IDEA Ultimate Edition (version 2025.1)
[√] Connected device (4 available)
[√] Network resources

Originally posted by @devroble in #588

devroble avatar Jun 12 '25 09:06 devroble