can I always use WorkManager instead of coroutines?

后端 未结 5 1645
没有蜡笔的小新
没有蜡笔的小新 2021-02-09 01:53

I wonder why should I bother with rx or coroutines when there is brilliant solution as WorkManager. But for almost all tutorials they use coroutines so may be WorkManager has di

5条回答
  •  既然无缘
    2021-02-09 02:08

    WorkManager:

    Support for both asynchronous one-off and periodic tasks Support for constraints such as network conditions, storage space, and charging status Chaining of complex work requests, including running work in parallel Output from one work request used as input for the next Handles API level compatibility back to API level 14(see note) Works with or without Google Play services Follows system health best practices LiveData support to easily display work request state in UI Waits proper time to run.

    Coroutines:

    Clean code, works under the hood in a different way. Run immediately.

    So depending on your requirements choose the better option.

提交回复
热议问题