All of us known we register BroadcastReceiver in two types
1)Static Registration
2)Dynamic Registration
But my doubt is when we need to use Static
and when we need to use Dynamic
?
As we know there are two ways to register a BroadcastReceiver
; one
is static and the other dynamic.
Static:
Dynamic:
Context.registerReceiver()
to dynamically register an instance.When we are doing dynamic registration (i.e. at run time) it will be associated with lifecycle of the app. If we do it static registration (i.e. on compile time) and our app is not running, a new process will be created to handle the broadcast.