Thanks. I had my code in the onHandleIntent() method, so it was, as you suggest, being executed on each call to startService. I've now got my code in the onCreate method and things are moving forward.
On Fri, Mar 2, 2012 at 11:49 PM, Mark Murphy <mmur...@commonsware.com>wrote: > On Thu, Mar 1, 2012 at 11:51 PM, Alan Smith <gpsanima...@gmail.com> wrote: > > The doco for startService states "If this service is not already > running, it > > will be instantiated and started (creating a process for it if needed); > if > > it is running then it remains running." I'm finding that each call to > > startService appears to be starting a separate instance of the service, > in > > that the work that the service is doing (in my test case, trivially > writing > > to a new log file) is being done again for each call. > > That does not mean that there are multiple instances of the service. > onStartCommand() will be called for each startService() call, so if > your work is there (or, say, in onHandleIntent() of an IntentService), > N calls to startService() will result in N runs through your work. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://github.com/commonsguy > http://commonsware.com/blog | http://twitter.com/commonsguy > > Warescription: Three Android Books, Plus Updates, One Low Price! > > -- > 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 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