Service keeps getting destroyed
问题 I have a service that uses media player to play some music. The service is started by an activity and if something is playing and the user moves away from the activity the service should keep playing in the background. Running the service in the foreground seems to work (I can see the notification), but in close to all cases the service is destroyed immediately (OnDestroy called by the system on the service). I know using startForeground does not mean that the service is never killed, but it