I have a service that I want to be stopped and then started fresh whenever a user hits a specific button, to which I have:
stopService(new Intent(getBaseContext(), TimerService.class));
startService(new Intent(getBaseContext(), TimerService.class));
However, I am under the impression that this is actually creating several services every time I hit the button. How do I start and stop the same service without creating duplicates?
EDIT: The items suggested unfortunately do not work for me. Upon attempting to implement the given answer it unfortunately does not change anything. My initial timer logs when its ticking and unfortunately the ticking is still occuring as the second timer, which is nested into the onFinish function is still yet to occur. So the services must not be stopped.