How to create a receiver without registering it in manifest file?

Answer: We can register receiver dynamically in code.

Description: Every component has to get registered in the manifest file. But there is an exception for this rule, a broadcast receiver can get registered dynamically in code. Because there may be some scenarios where we need handle broadcasted messages only when our application is running. If we register it in manifest file statically, then even if our app is not running, it may trigger our broadcast receiver.

 

No comments:

Post a Comment