Doing it in the background, the right way – Android services
In this recipe, we'll be introduced to the fantastic world of Android services! As you probably know, Android is multitasking from the very first version. Multitasking is not a simple thing for an operating system running on limited hardware. Let's think about the memory that could be allocated for days, or weeks, to some specific processes with the user that runs new apps over and over again. At some point, the memory will finish and the OS has to decide whether to prevent a new app from starting or to eliminate some old processes that the user hasn't used for a while. Obviously, the second option is the best; to allow new apps to run, the OS needs to free some memory still allocated to other apps. At this point, there is another question: which apps can be removed from the memory?
Let's leave this question unanswered for a moment and talk about the Android OS components. Android is a complex OS composed of a lot of different components...