In my current application (a game) I'm currently having problems
determining when to pause my audio. Pretty much the entire game runs
in a single Activity (basically a wrapper around some JNI code) so
changing between game states is irrelevant. My main problems come from
the key-lock screen and a 3rd party library which I use for leader-
boards and the like.

Previously I would pause/resume the audio whenever the appliction had
'onWindowFocusChanged' called which handled the key-lock screen as
expected. Unfortunately this had the side effect of causing
'AlertDialog' dialogs to cut out the audio when displayed.
Subsequently, I changed it to pause/resume audio in the 'onPause' and
'onResume' functions of the Activity. This works well except the sound
will continue to play when the key-lock screen is up. Is there any way
for me to detect when the key-lock screen gets displayed (apart from
constantly polling) and pause the sound when this occurs?

My other problem is that when I start the activity for the 3rd party
library (it actually starts it self after it establishes a network
connection), my audio stops playing (as the game's activity goes to
the background and gets "paused"). How can I detect when the entire
task/application goes to the background?

Thanks,
Grant

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to