androidserviceprocess

Difference between a process and service?


I want to know what is the difference between a process and a service in an android app? I tried to study about this topic a lot, but did not clear my basics yet...please help?


Solution

  • A process and a service are two different things:

    What is a Service?

    Most confusion about the Service class actually revolves around what it is not:

    Thus a Service itself is actually very simple, providing two main features:

    source: http://developer.android.com/reference/android/app/Service.html

    What is a Process

    When an application component starts and the application does not have any other components running, the Android system starts a new Linux process for the application with a single thread of execution. By default, all components of the same application run in the same process and thread (called the "main" thread). If an application component starts and there already exists a process for that application (because another component from the application exists), then the component is started within that process and uses the same thread of execution. However, you can arrange for different components in your application to run in separate processes, and you can create additional threads for any process.

    source: http://developer.android.com/guide/components/processes-and-threads.html#Processes