I have a very simple Android GPS logging app that runs a service. The Activity is nothing but a start/stop button to control the service. On a button click, I start a new backgr
A Service is actually running in the main thread, and if you do work that could take some time you should create a new thread. Android can do this for you if you use an IntentService instead of the regular Service.
I should add that Android will kill a process that occupie the main thread for more than 5(?)s. Locking the main thread will cause an ANR (Application Not Responding), and maybe this is what you experience in your Service.
Android does not terminate a background service when its parent activity is closed. But it suspends background jobs when device screen is locked. Your problem may be related to this. When screen is unlocked again, the service is expected to continue its work from where it left.