Murad Akhmedov
Murad Akhmedov

Reputation: 61

What happens when i call stopSelf in onDestroy method?

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()
    }

Upvotes: 2

Views: 47

Answers (1)

David Wasser
David Wasser

Reputation: 95626

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.

Upvotes: 0

Related Questions