IntentService简要分析IntentService 继承自 android.app.Service。内部实现极其简单。
onCreate()中去开启了一个 HandlerThread ,更简单的说,就是开启了一个线程。onStartCommoand(intent,startId)中启动的intent原封不动的丢给在 onCreate()中开启的线程。intent之后,执行用户定义的逻辑。执行结束之后调用了stopSelf()关闭了当前服务。onDeastry()中,会将该子线程的Looper轮询给退掉Looper.quit(selfLooper);原文:https://www.cnblogs.com/pythoncat/p/10511965.html