一 IntentService介绍 IntentService定义的三个基本点:是什么?怎么用?如何work? 官方解释如下: //IntentService定义的三个基本点:是什么?怎么用?如何work?*/ 1.IntentService is a base class for Services that handle asynchronous requests (expressed as Intents) on demand. 2.Clients send requests through…
Service#onStartCommand返回值解析 Service类有个生命周期方法叫onStartCommand,每次启动服务(startService)都会回调此方法.此方法的原型例如以下: public int onStartCommand(Intent intent, int flags, int startId) 须要关注的是这种方法有一个整型的返回值,它有下面选项: START_STICKY_COMPATIBILITY START_STICKY START_NOT_STICKY…
.HandlerThread Android API提供了HandlerThread来创建线程.官网的解释是: //Handy class for starting a new thread that has a looper. //The looper can then be used to create handler classes. //Note that start() must still be called. )但是需要注意的是,当activity退出了,这个HandlerThre…