Is it possible to have a service without any thread?
yes, you can have service running in main thread
No, service should have a thread, it can't run in main thread
option 1 is O.K only if you are not running any activity in Main thread.
Thread and service is no way related
Service is a component that performs some operation in the background with out having UI. But it doesn't mean that it will have separate thread to do it. By default if programmer doesn't provide any thread for the service, then it runs in Main UI thread. Since it is not good practice to run Activity & Services in single thread, it is suggestible to have separate thread for the service, except in few cases like where a given application is not having any activity in it.
Back To Top