On Wed, Dec 14, 2011 at 5:04 AM, DuneCat <[email protected]> wrote:
> I
> would like to be sure that only one instance of a specific subclass of
> Service or Application may exist.

There will be at most one active instance of a Service or Application.

> I guess I would just like to be sure that there is no
> overlap in the lifetime of separate instances of the same Service/
> Application implementation.

That depends on what you mean by "lifetime".

There should only ever be one instance of your Application, since that
is created for you automatically and lives as long as your process
does.

There will only be one active instance of your Service. IOW, if an
instance is created and not yet destroyed, a second instance will not
be created. However, there is a window of time between a Service being
destroyed and its object being finalized and garbage-collected. During
that window, another Service instance might be created (e.g., to
handle a fresh startService() call). So there might be multiple
instances of a Service in memory -- one active one and N
destroyed-but-not-GC'd ones.

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