Should i register and unregister the event bus in application class? If yes then where should i register and unregister it?
Once Register of event bus is done in application class then should i need to register the event bus in suscriber class?
Is there any problem occurs if i put some methods in Application class as a suscriber methods?
No one, except you, can tell whether you should or shouldn't register Application as a listener on EventBus - it depends on your app's use cases.
If the event is relevant to a specific Activity/Fragment/Service - register them as listeners.
If the event is relevant in the "global" sense (i.e. centralized error handling based on events) - you might register Application as listener.
You don't need to unregister Application from EventBus in order to prevent memory leaks because:
Application can be treated as Singleton object)onDestroy() method in ApplicationIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With