Android Question Check if service is running


Active Member
Licensed User
Longtime User
How I can check if a service is running ?

I start a service with StartService(...) in the activity create event (firsttime)

On the activity I have a button to turn on/off the service.
When I turn off the service and click on the home screen button
and do other stuff, later I bring the activity again to foreground than I want to check in the
acitivty resume event, if the service is started or not.
If not, I want to turn the service on again.