> I see what's happening now... but am struggling to resolve it.
>
> When I call unbindService(m_connection), the onDestroy() method of the
> service is called. This is where I do all my cleaning up and thread
> stopping. However, in instances where the activity has been paused and
> resumed, the same call to unbindService() does not result in the
> onDestroy() method being called.

AFAIK, a service will remain in a started state (no onDestroy() call) if:

-- somebody called startService() and nobody called stopService(), or

-- there are 1+ bindService() calls outstanding (i.e., corresponding
unbindService() has not been called)

> Perhaps I shouldn't be doing my clearing up in onDestroy() - but it
> still begs the question "why doesn't it get called". It means the
> service is still hanging around.

I don't think there are any assurances on timing of when a service started
via a bindService() will be stopped after the matching unbindService(). It
is possible that Android just hasn't gotten around to it yet.

-- 
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to