Why do you need to start the service at boot? That combined with what you write later about starting and stopping the service while your activity is running AND binding to it makes no sense to me. You're more likely to get a good answer if you explain more what you need the service for.
http://developer.android.com/training/articles/memory.html#Services http://developer.android.com/guide/components/services.html On Saturday, March 29, 2014 8:48:53 PM UTC+1, dashman wrote: > I've got a main activity that starts it's own service - if it's not > already started > by the system on boot. > > Right now I'm doing the bindService() call in onStart() and > unbind in onStop(). > > The problem is onStart() calls do not match onStop() - no 1:1 correlation. > Activity life-cycle explains that. > > So where should I put them - onPause() onResume() ??? > > > Also when I call bindService() - I call startService() - incase it's not > already started. > Is that ok??? > > bindService(intent, context, this, Context.BIND_AUTO_CREATE ); > startService( intent ); > > If it's already started by the system - it won't create another service - > right??? > > > > -- 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 --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.