You can call stopSelf () from within a service, or stopService (Intent) from another activity.
Sincerely, -Kitzy On Feb 23, 5:05 am, MobDev <developm...@mobilaria.com> wrote: > Lol, > I see I actually forgot to place the question in the first part of my > previous post :D > That is : if aServicealready 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 separateServiceentities that do exactly > the same... > > On 23 feb, 11:44, MobDev <developm...@mobilaria.com> wrote: > > > actually I had a question regarding this... > > I made aservicewhich plays an MP3, so it uses a single instance (in > > the wholeservice) of MediaPlayer.. > > Still I noticed (by mistake because theServicedidn't get closed > > while exiting my main Activity) that theServiceobviously kept > > running, but when I restarted my app it created anotherServicewhich > > 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 aSingleton'sbehaviour, I actually have > > two seperate entities of aServicerunning in the system... > > Also, a little question, I use the onBind() method and the .aidl > > interface methology to create myService... Is there a correct way to > > stop aService? 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" <mmur...@commonsware.com> wrote: > > > > > I'd like to know if it's possible to create a SingeltonService > > > > 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com 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.