On Fri, Aug 6, 2010 at 6:18 PM, Rajesh Bachani <[email protected]>wrote:

> Now when I call the stopService() method from A, the onDestroy() method in
> S is not called immediately.
>

The doc for stopServices says: "Request that a given application service be
stopped." Key words being "request" and "stopped".

>From the Service doc:

A service can be both started and have connections bound to it. In such a
> case, the system will keep the service running as long as either it is
> started or there are one or more connections to it with the
> Context.BIND_AUTO_CREATE<http://developer.android.com/reference/android/content/Context.html#BIND_AUTO_CREATE>
>  flag.
> Once neither of these situations hold, the service's 
> onDestroy()<http://developer.android.com/reference/android/app/Service.html#onDestroy()>
>  method
> is called and the service is effectively terminated.


My understanding: You're asking the system to stop the service, not to
destroy it. That will happen automatically, later, when it determines the
Service is no longer being used. For example, you could have another
activity that is bound to the service, so although it can be stopped, it
wouldn't be destroyed.

Why is this causing you a problem?

-------------------------------------------------------------------------------------------------
TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices

-- 
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