I have been looking through the documentation and sometimes the onStartCommand()
returns START_NOT_STICKY
, sometimes it returns the following:
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// TODO Auto-generated method stub
return super.onStartCommand(intent, flags, startId);
}
I am now confused as to why some services return super.onStartCommand(intent, flags, startId);
It all depends on what you want. The documentation says:
For backwards compatibility, the default implementation calls onStart(Intent, int) and returns either START_STICKY or START_STICKY_COMPATIBILITY.
So returning super.onStartCommand()
is equivalent to returning START_STICKY
. If you don't want the default behavior you can return another constant.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With