Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Jetpack WorkManager instead of the custom implementation #882

Open
bencehornak opened this issue Mar 11, 2025 · 0 comments
Open

Use Jetpack WorkManager instead of the custom implementation #882

bencehornak opened this issue Mar 11, 2025 · 0 comments

Comments

@bencehornak
Copy link
Contributor

bencehornak commented Mar 11, 2025

I have stumbled upon the custom PeriodicWork implementation in the project, which is used by the disk buffering implementation to export signals:

Its API is quite similar to that of the JetPack WorkManager API so I assume that you guys consciously decided not to use it, but to provide an own implementation. If this decision is already documented somewhere, could you point me there?

Otherwise I'd like to propose to use the Jetpack/androidx implementation, which is Google's official recommendation for doing periodic background work. It relies on sophisticated decisions made by the OS to optimize, when the best moment is to launch background tasks. E.g. one can set certain constraints to schedule the work only when the device is online, or if it's not low on battery (which is what I would recommend to set by default).

If I understand it correctly, it would work with the current minSdk (21), see the androidx.work docs:

WorkManager uses an underlying job dispatching service when available based on the following criteria:

  • Uses JobScheduler for API 23+
  • Uses a custom AlarmManager + BroadcastReceiver implementation for API 14-22

The downsides I can think of:

  1. I find it difficult to pass object references between Work objects and the rest of the code.
  2. Moreover, if the app developer decides to replace the default WorkManagerInitializer things get dirty very quickly.
  3. The minimum frequency is 1x every 15 minutes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant