要创建IntentService,请创建一个继承自的类IntentService,并在其中扩展一个覆盖onHandleIntent以下方法的方法:
package com.example.myapp;
public class MyIntentService extends IntentService {
@Override
protected void onHandleIntent (Intent workIntent) {
//根据workIntent的内容在后台执行某些操作。
}
}