Skip to content
توكيل صيانة ايديال زانوسي في مصر edited this page Dec 20, 2017 · 3 revisions

Background

Android applications only run when they are active (in the foreground). To run any code that needs to peform ongoing background tasks away from the application a service should be used. An example of this is a media player that wishes to continue playing music when the application itself is not open.

Services can continue to run even after an application acitivty has stopped. They are automatically stopped when the code performing the task stops or they can be stopped explicitly from an application and within the service itself.

Services can be used to run single and multi-threaded tasks in the background but the service itself is part of the same thread as the application that called it.

Services can be shared amongst applications or kept private to a single application.

Example Code

Checkout the Services folder.

Further Reading

Clone this wiki locally