Re: [android-developers] Intent Service not actually spawning a new thread

2010-09-16 Thread Kostya Vasilyev

 16.09.2010 20:21, Bret Foreman пишет:

According to the profiler, the onStartCommand method of the
IntentService is running on the main thread, not in a worker thread.
Any idea what could cause this behavior?
This is correct - onStartCommand is a framework method that exists in 
any service, and so is called by the framework on the UI thread. Same as 
with any service.


The IntentService-specific worker method is onHandleIntent:

http://developer.android.com/reference/android/app/IntentService.html#onHandleIntent(android.content.Intent)

this is called on the worker thread.

Make sure you don't override onStart / onStartCommand, or call the 
superclass. It's these methods in IntentService that dispatch the intent 
to the worker thread, and, ultimately, to onHandleIntent.


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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


[android-developers] Intent Service not actually spawning a new thread

2010-09-16 Thread Bret Foreman
My IntentService is blocking my UI thread and I wanted to find out
why. So I turned on profiling in the onStartCommand method of the
IntentService and turned it off at the end of the onStartMethod. The
working being done in between is web access with the Apache HTTP
client.

According to the profiler, the onStartCommand method of the
IntentService is running on the main thread, not in a worker thread.
Any idea what could cause this behavior?

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