Android How to Check Service is Running or Not

In some cases you might want to check that a service is running or not. An example user case would be, in your app there is a service that sync data to server and you have given user the possibility to toggle the related service on and off. So how do you know that the service is currently running or not? To Know service running status in your app won’t take more than two steps.

Firstly define below method to know the Service running status. This method return True if service is running.

Then Call the method by passing the service class name.

Enjoy Coding and Share Knowledge