I am trying to make my Service running in foreground. I tried to use this example (please look for the section \"Running a Service in the Foreground\")
This might be an old thread, but I'd like to add what I just learned which is not mentioned yet:
It is possible that a Service is still alive after stopSelf() is called because there are Activity that have bound to the Service. As a matter of fact, the startForeground() is just not going to show the notification nor giving any exception in this circumstance.