I am not for sure, but I think your activity has to bind to the service, or
your service needs to listen to a broadcast and your activity would need to
broadcast an intent that your service listens for, to shut down.

Curious, why do you play the music in a service? Why not in a separate
thread of the game? I am trying to learn game programming myself, and
thought that the process of playing music + sound FX all occur within the
game loop.. that you would some how every iteration update a sound/music
pointer for example and continue playing. I suppose if you have the same
music playing over and over.. but I'd rather have music that changes based
on the game play.. like speeds up in a fight, or changes pitch, or what have
you to provide a bit more dynamic music with the game.


On Tue, Jan 26, 2010 at 4:08 PM, Martin <[email protected]> wrote:

> Hi!
>
> I am programming a game. I have a service for the background-music.
> When I press the home-button and leave my activities, the service
> still runs in background. How can I stop the service, when there is no
> more visible activity in my program and restart it, when the user goes
> back to my game (some activity of it)?
>
> Greetings, Martin
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
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