我有以下意向服务:
public class BackGround extends IntentService {
Handler mhandler;
final static String NAME = "BackGround";
public BackGround(String name) {
super(NAME);
mhandler = new Handler();
}
public BackGround(){
super(NAME);
mhandler = new Handler();
}
@Override
protected void onHandleIntent(@Nullable Intent intent) {
Log.d("message","in intent service");//i don't get this message
}
}
这就是我在MainActivity中启动它的方式:
Intent intent = new Intent(MainActivity.this,BackGround.class);
startService(intent);
意向服务没有启动,我没有看到日志消息。