有没高手知道,如果不设置service 的onStartCommand返回值,使用默认的
return super.onStartCommand(intent, flags, startId)
service被系统kill后是什么状态?另外:如果设置返回值 START_STICKY ,是否自动重启后会执行onstartcommand方法?
如果设置返回值 START_NOT_STICKY,被系统杀死后,我在AlarmManager的setRepeating(pendingIntent=PendingIntent.getService(context, 0, intent,0);),service还会定时执行吗?急急急~~~
return super.onStartCommand(intent, flags, startId)
service被系统kill后是什么状态?另外:如果设置返回值 START_STICKY ,是否自动重启后会执行onstartcommand方法?
如果设置返回值 START_NOT_STICKY,被系统杀死后,我在AlarmManager的setRepeating(pendingIntent=PendingIntent.getService(context, 0, intent,0);),service还会定时执行吗?急急急~~~
这句话就是启动服务的状态,
状态值在START_CONTINUATION_MASK里面
START_CONTINUATION_MASK :如果是被killed掉,怎么继续这个服务
START_FLAG_REDELIVERY
START_FLAG_RETRY等
public int onStartCommand(Intent intent, int flags, int startId) { return super.onStartCommand(intent, flags, startId);
}
这样,service被系统killed掉后,会重启吗?如果重启会执行onStartCommand吗?
@Override
public int onStartCommand(Intent intent, int flags, int startId) { return super.onStartCommand(intent, flags, startId);
}
这样,service被系统killed掉后,会重启吗?如果重启会执行onStartCommand吗?