Audio doesn't stop when closing my game on android

  1. You could try to trap the hit on the home button and then call soundtrack.stop from there. I’ve had difficulty doing this, and I get the impression that the operating system developers have intentionally made this difficult in order to discourage its use. Others here may have good code for it.

  2. You could try switching media players; another player might shut off when the home button is hit. For example, in my tests the Android MediaPlayer seems to stop when the home button is hit. An example of use of the MediaPlayer was recently published in this forum and may be found here:https://discourse.processing.org/t/accessing-sound-in-android/31793/5

You could insert your own music file in the data folder and then hit the home button to verify that it indeed does shut off.

1 Like