On Mon, Nov 7, 2011 at 1:07 PM, Chris <chris.jara...@gmail.com> wrote:
> I'm having a problem with my IntentService. Every time I start my
> service, the onDestroy() method is called as soon as the service
> becomes idle.

That is largely the definition of an IntentService. Once
onHandleIntent() completes its work on the background thread, the
service shuts down. Or, as the IntentService JavaDocs puts it:

"IntentService is a base class for Services that handle asynchronous
requests (expressed as Intents) on demand. Clients send requests
through startService(Intent) calls; the service is started as needed,
handles each Intent in turn using a worker thread, and stops itself
when it runs out of work."

> Reading the developer docs gives me the impression that calling
> startForeground() will allow your service to persist, even when idle,
> except when there is an very high demand for memory, or am I reading
> this wrong?

You are incorrect in your interpretation of startForeground().

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

Android Training in NYC: http://marakana.com/training/android/

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