Android Services: Getting Started |

Learn about Android Services and the differences between foreground, background and bound services.

This is a companion discussion topic for the original entry at


First of all, thank you for the tutorial. It was very clear and to the point.

I had a quick question I was hoping to clear up here :slight_smile:

In stopService() of TimerService, stopSelf() is only called if the sdk version is equal or higher, than Oreo. If it isn’t, then stopForeground() is called. However, in the declaration of stopForeground(), it says that the method doesn’t actually stop the service and that stopSelf() should be called to do so. So, I’m wondering if that’s ok and what happens when the sdk version is lower than Oreo, and only stopForeground() is called.

Thank you!

Thank you for the tutorial.

I’d like to ask something:
the timer is running on the ui thread - you are using the handler with the MainLooper. so why do we have the co-routine run on the IO dispatcher just to submit all the work to the Main thread?

Thank you for the tutorial and for everything :slight_smile: