1

I register my broadcast receivers in the manifest. I would want to know when a broadcast receiver could be unregistered by the system or a task killer(some come with the system)

On older Android version it seems that if you force stop an application, it's broadcast receivers will no longer get called. I tested this on Android 6 or 7 and the receivers are called (you force close the app, for a minute you do not get any calls but after that it seems that your application comes back to life again)

On Xiaomi phones your broadcast receivers will not get called if AutoStart is not enabled.

Are there any other cases that I should know? If yes what would be the solution for this problem?

Thanks

Andrei Ciuca
  • 165
  • 1
  • 3
  • 17

1 Answers1

1

you can use unRegister(your broadcastreceiver) in onDestroy() override method. So it will unregister when ever your app is destroyed.For your Question why to unregister a broadcast receiver is because if you didnot unregister it.Then it will cause Memory Leakage.so the better code practice is to Unregister the receiver.