I agree with Dianne about not using service if you dont want it to run
when your app is inactive..

and if you wish to stop a service just call stopservice...it will call
the onDestroy method of your service...

On Jan 26, 9:55 pm, Dianne Hackborn <[email protected]> wrote:
> Having a service running gains you absolutely nothing as long as one of your
> activities is in the foreground.
>
> What do you mean "interrupt on low space?"  What low space?  Interrupt in
> what way?
>
>
>
> On Tue, Jan 26, 2010 at 6:07 PM, Martin <[email protected]> wrote:
> > But I don't want the sound to interrupt on low space. This happens
> > very often on my phone if I just use the MediaPlayer in one of my
> > applications.
> > Does your solution solve this problem?
> > Greetings, Martin
>
> > On 27 Jan., 02:53, Dianne Hackborn <[email protected]> wrote:
> > > If the purpose is to only run while one of your activities is in the
> > > foreground, there is no need for a service.  Just make a manager class
> > with
> > > a global singleton, which the activities use to tell when it should run.
>
> > > 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]><android-developers%2Bunsubs
> > [email protected]>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > > --
> > > Dianne Hackborn
> > > Android framework engineer
> > > [email protected]
>
> > > Note: please don't send private questions to me, as I don't have time to
> > > provide private support, and so won't reply to such e-mails.  All such
> > > questions should be posted on public forums, where I and others can see
> > and
> > > answer them.
>
> > --
> > 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
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

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