Android applications should use background tasks when appropriate, and avoid doing everything on the app's main thread. In order to make the app both responsive for your users as well as a good citizen on the Android platform, take any blocking or long-running tasks off the main (UI) thread, and run them in the background instead. This includes tasks like decoding a bitmap, accessing storage, working on a machine learning (ML) model, or performing network requests.
Get started with the docs
To build robust apps, you'll need to understand key concepts like:
Asynchronous work options such as Kotlin coroutines and Java threads, and the differences between asynchronous and persistent work.
Persistent work, which is background work that remains scheduled through app restarts and system reboots.
Effective use of broadcasts. Much like the publish-subscribe design pattern, Android apps can send or receive broadcast messages from the Android system and other Android apps.
How to use the different techniques necessary to test asynchronous work versus testing persistent work.
For a comprehensive look at these concepts and guidance on how to choose the right API for your use case, reference the background tasks overview guide.