Handle programmatically unregister BroadcastReceiver on process death

我的梦境 提交于 2019-11-29 16:54:09
Onik

I want to make sure that when my app's process unexpectedly die (get killed) no memory leak is caused by the receiver and if it does what are my options?

When an app process gets killed by the system (quite) everything associated with the process is "gone". No memory leaks from the app component's (Activity, Service, BroadcastReceiver) side can be expected.

Edit
When process get killed ActivityManagerService clean all app resources using cleanUpApplicationRecordLocked method here.
You can clearly see that all resources including all registered broadcast receivers being cleaned.(Ln. 15598)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!