Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Android: How to pause background music when app goes to background?

$
0
0

I have a (heavyweight) window where I start a background music using:

var music = Ti.Media.createSound({
  url: '/snd/music.aac',
  allowBackground: true
});
music.play();
The allowBackground property is true, because the music needs to keep playing when the app opens new (heavyweight) windows on top of it. Without it, the music will pause because its activity is paused.

But when the complete app (task) goes to the background I do want to pause the music. And so far I have not found a way to do so. The activities have a pause event, but not the app as a whole. I've also found questions about this on Android naive, so I'm afraid this is not just an easy thing to do.

The only "solution" found on Android forums is to keep track of activities in order to detect if pausing one would show another activity of the app itself or another app.

Related JIRA: https://jira.appcelerator.org/browse/TIMOB-15094


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>