onStartCommand()是由Android系统调用的,本质上也是调用了onStart()方法。
onStartCommand()返回值有几种:
1)START_STICKY
英文解释:
Constant to return from onStartCommand
: if this service's process is killed while it is started (after returning from onStartCommand
), then leave it in the started state but don't retain this delivered intent. Later the system will try to re-create the service. Because it is in the started state, it will guarantee to call onStartCommand
after creating the new service instance; if there are not any pending start commands to be delivered to the service, it will be called with a null intent object, so you must take c