Skip to content

Android plugin always declares FOREGROUND_SERVICE_DATA_SYNC even when no foreground service task is used #725

Description

@belabiedredouane

In recent workmanager_android versions, the Android manifest always declares:

<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SHORT_SERVICE"/>

and merges:

android:foregroundServiceType="dataSync|shortService"

onto androidx.work.impl.foreground.SystemForegroundService.

This causes Google Play Console to ask for a foreground service declaration and a demonstration video for FOREGROUND_SERVICE_DATA_SYNC, even when the app does not use Workmanager for any user-visible data sync or foreground-service workflow.

Our use case is simple periodic local maintenance:

  • Schedule a periodic task with registerPeriodicTask.
  • Clean old local scan history stored on device.
  • No upload/download.
  • No backup/restore.
  • No server sync.
  • No explicit ForegroundServiceConfig.
  • No user-visible foreground service feature.

Because the permission is declared by the plugin manifest unconditionally, Play Console treats the app as using FOREGROUND_SERVICE_DATA_SYNC.

Would it be possible to make these foreground-service permissions/service types opt-in instead of always merged?

Possible solutions:

  1. Do not declare FOREGROUND_SERVICE_DATA_SYNC / FOREGROUND_SERVICE_SHORT_SERVICE unless the app explicitly enables foreground service support.
  2. Provide manifest placeholders to disable these declarations.
  3. Split foreground-service support into a separate Android manifest entry or plugin configuration.
  4. Document the recommended way for apps to remove these permissions safely when they only use normal background WorkManager tasks.

Expected behavior:

Apps using Workmanager only for regular background tasks should not be forced to declare FOREGROUND_SERVICE_DATA_SYNC in Play Console.

Actual behavior:

The permission is included in the final merged manifest because workmanager_android declares it unconditionally.

For now, we had to pin older versions:

workmanager: 0.9.0+3

dependency_overrides:
  workmanager_android: 0.9.0+2
  workmanager_apple: 0.9.1+2
  workmanager_platform_interface: 0.9.1+1

This removes the data sync permission, but it is not a good long-term solution.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions