I'm getting a NetworkOnMainThreadException
in my Service
class, which by nature doesn't make sense, because Services are background processes as far as I understand.
In the Service method, I'm making a call to a static helper method to download data. I'm using the DefaultHttpClient as well.
What's going on here?
onStartCommand()
runs on the UI thread in aService
. Try using IntentService, or alternatively use any other threading method in theService
(Handler
/Runnable
,AsyncTask
).