

Running long-running operations on the main thread can lead to app freezes, unresponsiveness, and thus, poor user experience. Android apps use the main thread to handle UI updates and operations (like user input). 04 auth0 integration: Project with the code from the Securing an Android Application with Auth0 section.Īn app might need to perform long-running tasks such as downloading/uploading files, syncing data from a server and updating the local database, executing expensive operations on data, working on machine learning models, decoding bitmaps, etc.03 alarmmanager: Project with the code from the AlarmManager section.02 workmanager: Project with the code from the WorkManager section.01 threading: Project with the code from the Threading section.
:max_bytes(150000):strip_icc()/AndroidUnblockContact-cb31a2edd1184612b24b18fcf9002846.jpg)
It's the default Android app that you get when you follow the Android Studio prompts for creating an app with an Empty Activity. 00 starter project: This is the starting point of the other projects in the folder.

There are 5 folders containing code for the different sections: You can find the code used in the tutorial in this repository. You don't need to be an expert, you just need the basic knowledge of how Android apps work - if you have a basic understanding of working with Android Views, handling events, navigating between Views, then you should be fine. Lastly, you should have some knowledge of Java and Android development. You can use another IDE if you prefer, like IntelliJ, but we will only include instructions for Android Studio. You can download Android Studio from this resource. Second, we recommend you install Android Studio, the official Integrated Development Environment (IDE) for Android. If you don't have it, follow the instructions here to download and install a JDK. To follow along with this tutorial, you should have Java Development Kit 8 (JDK 8) or higher installed on your computer. Android has several options for running tasks in the background and in this article, we'll look at the recommended options for running different types of tasks. To mitigate this, long-running operations should be run in the background. Running long-running operations on the main thread can lead to app freezes, unresponsiveness and thus, poor user experience.

I really like when someone has a complete working sample, so I will provide that as well you can refer source code at this article. I couldn’t find any decent examples on the web or StackOverflow, so I decided to put one together. Recently, I needed send data from background service to activity.
