Kenneth WON wrote:
> The purpose of this app is to run the service forever until shutdown
> the phone, and after the user leaves the app and return later, the
> service will not launch again, means only have one of this service
> running.

Please don't do that.

First, it's not possible:

http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-are-not/

Second, it's a bad idea to even try:

http://www.androidguys.com/2010/03/29/code-pollution-background-control/

> Now, the problem is it can't only have one of this service running.

What is "it"?

Services are natural singletons -- there is exactly 0 or 1 copy of the
service running at any point. The goal is for there to be 0 copies of
the service running unless it is actively delivering user-perceived value.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Beginning Android 2_ from Apress Now Available!

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

Reply via email to