So, to clear some things. Services can be of two types, not necessarily mutually exclusive.
These two types are triggered and limited.
The STARTED service starts with startService() and is usually used to perform background operations, which are somewhat independent of the activity flow. For example, an extensive service for downloading remote data can be launched regardless of the activity it creates, and then simply return the result when ready.
The initial service continues to run until it stops.
The BOUNDED service is more like an IPC client-server pattern. For example, an audio player should be a related service so that activity can request a service about the state of a media player, for example. track name, length ...
A Bound Service works as long as there is a component associated with it.
So, if your service is running, you must stop it from your implementation using stopSelf() or stopService() . If it is connected, it stops when there are no components associated with it. You unbind the service using unbindService() . Please note that the service may be a running and related service!
For more information, see the following:
http://developer.android.com/guide/components/services.html
Consider also using IntentService instead of Service in your application, as it seems that you do not need your service for multithreading.
source share