Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
IntentService(String name)
Creates an IntentService.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
IBinder | onBind(Intent intent)
Unless you provide binding for your service, you don't need to implement this method, because the default implementation returns null.
|
||||||||||
void | onCreate()
Called by the system when the service is first created.
|
||||||||||
void | onDestroy()
Called by the system to notify a Service that it is no longer used and is being removed.
|
||||||||||
void | onStart(Intent intent, int startId)
This method is deprecated. Implement onStartCommand(Intent, int, int) instead.
|
||||||||||
int | onStartCommand(Intent intent, int flags, int startId)
You should not override this method for your IntentService.
|
||||||||||
void | setIntentRedelivery(boolean enabled)
Sets intent redelivery preferences.
If enabled is true, If enabled is false (the default),
设置为true时, onStartCommand
返回
START_REDELIVER_INTENT,否则返回
START_NOT_STICKY
关于此的更多内容请参考《 Service简介
》
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract void | onHandleIntent(Intent intent)
This method is invoked on the worker thread with a request to process.
This method is invoked on the worker thread with a request to process. Only one Intent is processed at a time, but the processing happens on a worker thread that runs independently from other application logic. So, if this code takes a long time, it will hold up other requests to the same IntentService, but it will not hold up anything else. When all requests have been handled, the IntentService stops itself, so you should not call
stopSelf()
.
该函数用于针对Intent的不同进行不同的事务处理就可以了.执行完所一个Intent请求对象所对应的工作之后,如果没有新的Intent请求达到,
则自动停止Service;否则
ServiceHandler会取得
下一个Intent请求传人该函数来处理其所对应的任务。
|