Search code examples
androidservice

How to make sure that you don't start a service twice android


Is there a way to check that the service is not already running before starting it?

If it could be in the onCreate() of the service it will be even better,

Thank you!


Solution

  • fix it with a boolean/flag in the service. (A service can only be started once)