Officially, the Enable
flag is for whether or not the Service
can be instantiated by the system. But what does that mean in practice? Say I set android:enabled="false”
. Does that mean START_STICKY will no longer work? How about START_REDELIVER_INTENT?
It means the Service
will not be created or run at all, regardless of what is returned from the onStartCommand()
method, as it will never reach that point.
Just like for an Activity
, Service
instantiation is handled by the system, so when the documentation indicates that the system cannot instantiate a Service
when enabled
is false
, it means that the Service
just will not be run.