I want to create a single button which serves both functions of Starting and Stopping a service.
Also I want to make sure that even if user quits the application and again comes back then according to whether service is running or not, I want to show appropriate Text on Button.
So in short, With what thing I can get to know if service is running or not ?
You can check if service is running or not with below code. Rest of the question is logic based once you find the service is running or not.
I refer this answer just check it