Skip to main content
InterviewHubPRO
Section Overview
Q14

Question 14 of 50

Part 2: Compose Internals, Persistence, DI & Background Work (11 - 24)

28%
Android & Jetpack Compose (50 Qs)•Part 2: Compose Internals, Persistence, DI & Background Work (11 - 24)

What is WorkManager and when should it be used over Coroutines?

senior LevelDocker & Containers

In Simple Words: WorkManager is the recommended solution for persistent, deferrable background work:

  • Coroutines: Bound to app process memory. If the user swipes the app away or Android OS kills the process in low-RAM conditions, coroutines are killed immediately!
  • WorkManager: Persists task jobs to an internal SQLite database. Guarantees execution even if the app is killed or the phone is rebooted!
  • Allows setting execution constraints: setRequiredNetworkType(NetworkType.UNMETERED) (only on Wi-Fi), setRequiresCharging(true).