Please look at the various service examples in ApiDemos, they cover a lot of
different ways to interact with them.

On Tue, Feb 23, 2010 at 4:05 AM, MobDev <[email protected]> wrote:

> Lol,
> I see I actually forgot to place the question in the first part of my
> previous post :D
> That is : if a Service already is running, is there some way to bind
> to it when my app starts up, and/or programmatically check if it's
> already running ?
> So that I won't be having 2 separate Service entities that do exactly
> the same...
>
> On 23 feb, 11:44, MobDev <[email protected]> wrote:
> > actually I had a question regarding this...
> > I made a service which plays an MP3, so it uses a single instance (in
> > the whole service) of MediaPlayer..
> > Still I noticed (by mistake because the Service didn't get closed
> > while exiting my main Activity) that the Service obviously kept
> > running, but when I restarted my app it created another Service which
> > also could play the MP3, thus creating a "mixing" effect, having the
> > same MP3 playing double... The second one I could stop through my App
> > but the first "lost" one couldn't be stopped...
> > To me this doesn't look like a Singleton's behaviour, I actually have
> > two seperate entities of a Service running in the system...
> > Also, a little question, I use the onBind() method and the .aidl
> > interface methology to create my Service... Is there a correct way to
> > stop a Service ? And if so where should this be implemented (for
> > example unBind() in the onDestroy() method of my main Activity) ?
> > Thanks in advance Mark (or anyone who might shed some light on my
> > issue) !
> >
> > On 11 feb, 17:11, "Mark Murphy" <[email protected]> wrote:
> >
> > > > I'd like to know if it's possible to create a Singelton Service
> > > > throughout an application ?
> >
> > > Services are singletons by their very nature.
> >
> > > --
> > > Mark Murphy (a Commons Guy)http://commonsware.com
> > > Android App Developer Books:http://commonsware.com/books.html
>
> --
> 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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to