From 6bc988b094763d28989e4fb8796b5e0a1006d79e Mon Sep 17 00:00:00 2001 From: Sebastian Roth Date: Tue, 4 Aug 2026 20:05:58 +0100 Subject: [PATCH 1/2] chore(release): publish packages - workmanager@0.10.7 - workmanager_android@0.10.6 - workmanager_web@0.2.0 --- .github/workflows/pages-demo.yml | 2 +- CHANGELOG.md | 40 ++++++++++++++++++++++++++++++++ workmanager/CHANGELOG.md | 5 ++++ workmanager/pubspec.yaml | 6 ++--- workmanager_android/CHANGELOG.md | 5 ++++ workmanager_android/pubspec.yaml | 2 +- workmanager_web/CHANGELOG.md | 4 ++++ workmanager_web/pubspec.yaml | 2 +- 8 files changed, 60 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pages-demo.yml b/.github/workflows/pages-demo.yml index afa398d5..91300211 100644 --- a/.github/workflows/pages-demo.yml +++ b/.github/workflows/pages-demo.yml @@ -2,7 +2,7 @@ name: pages-demo on: push: - branches: [feat/web-worker-messaging] + branches: [main] workflow_dispatch: permissions: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e2a5a50..78954fdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,46 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline --- +Packages with breaking changes: + + - There are no breaking changes in this release. + +Packages with other changes: + + - [`workmanager` - `v0.10.7`](#workmanager---v0107) + - [`workmanager_android` - `v0.10.6`](#workmanager_android---v0106) + - [`workmanager_web` - `v0.2.0`](#workmanager_web---v020) + +Packages with dependency updates only: + +> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project. + + - `workmanager` - `v0.10.7` + +--- + +#### `workmanager` - `v0.10.7` + + - **FEAT**(web): bidirectional message channel between page and background worker (#708). + - **FIX**(android): make FOREGROUND_SERVICE_DATA_SYNC opt-in (#725). + +#### `workmanager_android` - `v0.10.6` + + - **FIX**(android): make FOREGROUND_SERVICE_DATA_SYNC opt-in (#725). + - **FEAT**(android): fail loudly when a foreground service permission is missing from the merged manifest. + +#### `workmanager_web` - `v0.2.0` + + - **FEAT**(web): bidirectional message channel between page and background worker (#708). + +--- + +## 2026-08-04 + +### Changes + +--- + Packages with breaking changes: - There are no breaking changes in this release. diff --git a/workmanager/CHANGELOG.md b/workmanager/CHANGELOG.md index bc89339d..36ab8a68 100644 --- a/workmanager/CHANGELOG.md +++ b/workmanager/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.10.7 + + - **FEAT**(web): bidirectional message channel between page and background worker (#708). + - **FIX**(android): make FOREGROUND_SERVICE_DATA_SYNC opt-in (#725). + ## 0.10.6 - **FIX**(android): build with AGP 9 and android.builtInKotlin=false (#722). diff --git a/workmanager/pubspec.yaml b/workmanager/pubspec.yaml index f3061e76..42de08b5 100644 --- a/workmanager/pubspec.yaml +++ b/workmanager/pubspec.yaml @@ -1,6 +1,6 @@ name: workmanager description: Flutter Workmanager. This plugin allows you to schedule background work on Android and iOS. -version: 0.10.6 +version: 0.10.7 # publish_to: none homepage: https://github.com/fluttercommunity/flutter_workmanager repository: https://github.com/fluttercommunity/flutter_workmanager @@ -14,9 +14,9 @@ dependencies: flutter: sdk: flutter workmanager_platform_interface: ^0.10.4 - workmanager_android: ^0.10.5 + workmanager_android: ^0.10.6 workmanager_apple: ^0.9.10 - workmanager_web: ^0.1.3+1 + workmanager_web: ^0.2.0 workmanager_linux: ^0.1.1 dev_dependencies: diff --git a/workmanager_android/CHANGELOG.md b/workmanager_android/CHANGELOG.md index 9a652dce..772a096d 100644 --- a/workmanager_android/CHANGELOG.md +++ b/workmanager_android/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.10.6 + + - **FIX**(android): make FOREGROUND_SERVICE_DATA_SYNC opt-in (#725). + - **FEAT**(android): fail loudly when a foreground service permission is missing from the merged manifest. + ## 0.10.5 - **FIX**(android): build with AGP 9 and android.builtInKotlin=false (#722). diff --git a/workmanager_android/pubspec.yaml b/workmanager_android/pubspec.yaml index 145790af..360b8bdd 100644 --- a/workmanager_android/pubspec.yaml +++ b/workmanager_android/pubspec.yaml @@ -1,6 +1,6 @@ name: workmanager_android description: Android implementation of the workmanager plugin. -version: 0.10.5 +version: 0.10.6 # publish_to: none homepage: https://github.com/fluttercommunity/flutter_workmanager repository: https://github.com/fluttercommunity/flutter_workmanager diff --git a/workmanager_web/CHANGELOG.md b/workmanager_web/CHANGELOG.md index 7bd44926..c3bb2a1e 100644 --- a/workmanager_web/CHANGELOG.md +++ b/workmanager_web/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.0 + + - **FEAT**(web): bidirectional message channel between page and background worker (#708). + ## 0.1.3+1 - Update a dependency to the latest release. diff --git a/workmanager_web/pubspec.yaml b/workmanager_web/pubspec.yaml index 9769eebc..0e99c8b4 100644 --- a/workmanager_web/pubspec.yaml +++ b/workmanager_web/pubspec.yaml @@ -1,6 +1,6 @@ name: workmanager_web description: Web (experimental) implementation of workmanager using a Service Worker and Web Worker for background task execution. -version: 0.1.3+1 +version: 0.2.0 # publish_to: none homepage: https://github.com/fluttercommunity/flutter_workmanager repository: https://github.com/fluttercommunity/flutter_workmanager From c916262a7485e0873058994299c4c68befd32175 Mon Sep 17 00:00:00 2001 From: Sebastian Roth Date: Tue, 4 Aug 2026 20:17:29 +0100 Subject: [PATCH 2/2] docs: fix work-info wording, document FGS opt-in + web messaging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - work-info.mdx: replace 'the maintainer explicitly declined to surface it' with a neutral design statement (docs.page garbling). - troubleshooting.mdx: new section for the Play Console FOREGROUND_SERVICE_DATA_SYNC declaration/video requirement — what it means, when to opt in, and that a missed opt-in throws at registration. - web.mdx: document the page<->worker messaging API (sendMessageToWorker, workerMessages, sendToPage) and link the live demo. - workmanager_impl.dart: dartdoc note + docs.page link on registerOneOffTask's foregroundServiceConfig (dataSync opt-in). --- docs/troubleshooting.mdx | 23 +++++++++++++++++++ docs/web.mdx | 28 +++++++++++++++++++++++ docs/work-info.mdx | 4 ++-- workmanager/lib/src/workmanager_impl.dart | 6 ++++- 4 files changed, 58 insertions(+), 3 deletions(-) diff --git a/docs/troubleshooting.mdx b/docs/troubleshooting.mdx index dfd37ec7..5a9583b7 100644 --- a/docs/troubleshooting.mdx +++ b/docs/troubleshooting.mdx @@ -165,6 +165,29 @@ Make sure the basics are right before debugging further: - Prefer processing tasks for work that needs minutes; one-off and refresh tasks get only seconds of budget. +## Android: Play Console asks for FOREGROUND_SERVICE_DATA_SYNC + +If Play Console demands a **foreground-service declaration** and a +demonstration video for `FOREGROUND_SERVICE_DATA_SYNC` (or the type +`dataSync`), even though your app only runs plain periodic background tasks: + +- The plugin only declares `FOREGROUND_SERVICE_DATA_SYNC` when you opt in. + It is a Play Console "special type" with a declaration + video requirement, + so the default merged manifest deliberately leaves it out. +- **You did not opt in** → the merged manifest has no `dataSync` permission. + Nothing to do; if Play still lists it, check your own manifest or other + dependencies. +- **You did opt in** → you set `workmanager.enableDataSyncForegroundService=true` + in `gradle.properties` (or `-P` on the CLI) to run long-running workers + with the `dataSync` foreground service type. Play then asks for the + declaration + video — that is expected; complete them. + +If your worker requests `foregroundServiceType=dataSync` without the opt-in +property, the plugin **throws at registration** with instructions (instead of +failing silently later). The `shortService` type used by expedited work is +always declared and needs no Play declaration. See +[issue #725](https://github.com/fluttercommunity/flutter_workmanager/issues/725). + ## Reporting a genuine bug If you believe the plugin itself is broken, the issue must include: diff --git a/docs/web.mdx b/docs/web.mdx index ead123ab..c4b56c51 100644 --- a/docs/web.mdx +++ b/docs/web.mdx @@ -23,6 +23,34 @@ closed") is approximated as honestly as browsers allow. Results are replayed into the app's log on the next page load. +## Messaging with the background worker + +Beyond task results, the page and the worker can exchange free-form messages +while the page is open: + +```dart +// Page side — send a message, listen for replies. +WorkmanagerWeb().workerMessages.listen((payload) { + print('worker says: $payload'); +}); +WorkmanagerWeb().sendMessageToWorker({'op': 'watch', 'city': 'cardiff', 'threshold': 5.0}); +``` + +```dart +// Dispatcher side (Flutter-free bundle) — receive and reply. +WorkmanagerExecution.instance.messageHandler = handleWorkerMessage; +// …inside the handler, send back: +WorkmanagerExecution.instance.sendToPage?.call(reply); +``` + +## Live demo + +A self-contained demo (landing page + worker chat + persistent background +task queue + Service Worker notifications) is hosted at + and lives in the +repo's `example/` folder. The demo's Guide tab walks through the "install the +PWA, close the tab, trigger periodic sync, reopen" flow step by step. + ## Honest limitations - **No exact scheduling** — there is no "run at 15:00" on the web. diff --git a/docs/work-info.mdx b/docs/work-info.mdx index 1ab938a5..7fda976c 100644 --- a/docs/work-info.mdx +++ b/docs/work-info.mdx @@ -33,8 +33,8 @@ if (info == null) { The state mapping is deliberately small: it is the intersection of what Android WorkManager and the plugin's own Apple-side state can truthfully -report. There is no `runAttemptCount` (the maintainer explicitly declined to -surface it) and no streaming/observation API — this is a one-shot query. +report. There is deliberately no `runAttemptCount` and no +streaming/observation API — this is a one-shot query. ## Per-platform truthfulness diff --git a/workmanager/lib/src/workmanager_impl.dart b/workmanager/lib/src/workmanager_impl.dart index 7415d623..73588ca8 100644 --- a/workmanager/lib/src/workmanager_impl.dart +++ b/workmanager/lib/src/workmanager_impl.dart @@ -257,7 +257,11 @@ class Workmanager { /// runs as an Android foreground service for the whole duration of the /// task. This allows work to keep running beyond the usual background /// execution limits, in exchange for a persistent notification. See - /// [ForegroundServiceConfig] for the available options. + /// [ForegroundServiceConfig] for the available options. Note: using the + /// `dataSync` service type requires the + /// `workmanager.enableDataSyncForegroundService=true` gradle property — + /// see the troubleshooting guide: + /// https://docs.page/fluttercommunity/flutter_workmanager/troubleshooting Future registerOneOffTask( String uniqueName, String taskName, {