Never call unbindService() method on a Service?

58 Views Asked by At

I have scenario(for theoretical purposes):

What happens if, say, there is only one Activity that is bound to a Service and it decides to never call unbindService() method?

Will the Service ever get destroyed, in this case?

1

There are 1 best solutions below

0
user496854 On BEST ANSWER

Whenever the Context that bound to a service is destroyed, The OS is supposed to unbind it for you. According to Google's documentation, calling unbindService() yourself is recommended because "Doing so allows the idle service to shut down", but that's not a requirement