What happens when i call stopSelf in onDestroy method?

33 views Asked by At

I have such a method implementation and I want to understand what will happen when this method is called. Could you give me a hint

override fun onDestroy() {
        Timber.d("$this: onDestroy")
        stopSelf()
        super.onDestroy()
    }
1

There are 1 answers

0
David Wasser On BEST ANSWER

onDestroy() should only be called by Android when the Service has already stopped. Android won't call onDestroy() if the Service is running. If you call stopSelf() in onDestroy() it should just do nothing, as the Service is already stopped.