I have a bound service playing sounds with Soundpool
. It works normally if the app exits normally (using back button).
However, when the app is killed by the recent app, in the next run, the service (sound) behaves abnormally, especially, when the screen is OFF.
In detail:
- When the app starts after being killed by the recent app, I still can play the sound normally when the screen is ON.
- When the screen is OFF, the sound plays OK in next few seconds and then start to flicker. However, the symptom disappears when the screen turned back on.
I tested with Android N. And the code is nothing special, just like this link from Android developer website.
I don't know what is the differences between normal exit and app killed by recent apps.
How to properly stop the bound service if the app is removed from recent apps. Any help?
Thanks