I have a LocalBroadcastReceiver
and I am unregistering
it in my ondestroy()
.
Now i read about ondestroy()
mentioned in these two SO answers is-ondestroy-not-always-called and why-implement-ondestroy-if-it-is-not-guaranteed-to-be-called and as well as in Androi Docs that
onDestroy will be called if you explicitly call finish();
But why in my case I am not calling finish()
but still ondestroy()
is getting called everytime in all of my Android devices. Also according to you guys where are the cases where ondestroy()
not get called up.
Also even if Android will kill my app(due to less memory) I don't need to worry as Android is going to kill my whole app so receiver will ultimately get killed.(So there won't be any Memory Leak).
So for my use case which cases are there where ondestroy()
is not going to get called up.