在Activity中,startService()创建IntentService的时候,通过打印线程id,得知当前线程是1// long id = Thread.currentThread().getId();
在IntentService的默认构造函数中,打印线程id 仍然为1
在onHandleIntent()中打印id,发现id为96,说明在onHandleIntent()处理事件的时候,系统会自动开辟新的线程去处理,这就是IntentService的用处,
All requests are handled on a single worker thread -- they may take as long as necessary (and will not block the application‘s main loop), but only one request will be processed at a time.
所有的请求都在一个单独的工作线程里执行,所有的请求都必须等待上一线程执行完毕,无论这一等待时长需要多久。
原文:http://www.cnblogs.com/wudizbb/p/3554676.html