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 <developm...@mobilaria.com> 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" <mmur...@commonsware.com> 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 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