Android Docs say,
A Service runs in the main thread of its hosting process—the service does not create its own thread and doesnot run in a separate process (unless you specify otherwise).
So it is going to block the main thread of the application which started it.
I have a simple advice for you, use
IntentService for doing n/w IO, file IO or other
CPU intensive or time consuming operations.
IntentService is a subclass of
Service and provides added benefits.
Good things about IntentService:
- It runs in its own thread, so you dont have to implement any threading.
- It stops itself once the work is finished.
--
Thanks & Regards------------------------------
Jaydeep
Software Engineer