I have a Service used for playing audio. It is created with START_STICKY
, and calls startForeground()
when it is told to play music, and stopForeground()
when it is told to stop playing music.
The service continues to run fine and play music, even after the app is swiped out of the task manager on 4.2.1. However, the service is inexplicably killed if the app is swiped out and the app's home/lockscreen widget is interacted with or if I try to sendBroadcast()
within the service.
I cannot find anything that would cause a crash, no low memory warnings, the Service is not bound to anything, just:
10-09 17:14:42.186: I/ActivityManager(2591): Killing 18400:com.xperia64.timidityae/u0a10079: remove task
10-09 17:14:42.236: W/ActivityManager(2591): Scheduling restart of crashed service com.xperia64.timidityae/.MusicService in 5000ms
The dumpsys activity services command always produces this, as it should be:
Proc # 8: adj=prcp /FS trm= 0 22326:com.xperia64.timidityae/u0a10079 (fg-service)
My app does some heavy JNI MIDI->wav processing, but even if I play a basic MP3 with a MediaPlayer
, the killing of the service still occurs. Also, I have a custom notification with buttons if that makes a difference. I have also tried forcing a PARTIAL_WAKELOCK
, but that did not help either.