Answer the question
In order to leave comments, you need to log in
Is it no longer customary to use services for background tasks in android?
Hello.
I'm studying android, on startandroid I saw this:
Once upon a time, services were designed for background work. But in Android 8 they were very limited: if the application is not active, then the service will be stopped after some time. And long before Android 8, developers started using tools like JobScheduler or Firebase JobDispatcher to run background tasks.
WorkManager is a new tool. It allows you to run background tasks sequentially or in parallel, transfer data to them, get a result from them, monitor the execution status and run only if the specified conditions are met.
Answer the question
In order to leave comments, you need to log in
Services in 2019 should actually only be used for foreground tasks that are not directly on the screen. A la music player and playing music, and the like.
Any "long operations and calculations", any uploads of large files to the network and the like should be done using WorkManager'a.
Some time ago, I also recommended using the evernote library , for example, we haven’t migrated from it in the prod yet.
Background tasks can be very different, for example, accessing the network or accessing the database in a separate thread are also background tasks, but they (in most cases) do not need services or WorkManager.
It is worth reading about the limitations of different versions of android (menu on the left) and learn how and where to use WorkManager .
everything is so simple and depends on some details?Everything is ambiguous, you don’t need to bury services, there are cases when you can’t do without them, for example, Foreground Service.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question