What is the difference between Service and IntentService? How is each used?
Copied from https://developer.android.com/guide/components/services.html
A Service is an application component that can perform long-running operations in the background, and it does not provide a user interface. It is used to play music, handle network transaction, download, etc. When service is started, it continues to run in the background even if the user switches to another application.
Service
is the base class for Android services that can be extended to create any service. A class that directly extends Service runs on the main thread so it will block the UI (if there is one) and should therefore either be used only for short tasks or should make use of other threads for longer tasks.
IntentService
is a subclass of Service that handles asynchronous requests (expressed as “Intents”) on demand. Clients send requests through startService(Intent)
calls. The service is started as needed, handles each Intent in turn using a worker thread, and stops itself when it runs out of work. Writing an IntentService can be quite simple; just extend the IntentService class and override the onHandleIntent(Intent intent)
method where you can manage all incoming requests.