EventBus
EventBus copied to clipboard
Lifecycle Awareness
Whats about the registering and unregistering, why cann't the @Subscribe function be Lifecycle Aware, registering on Class creation and unregistering on destruction, would be really neat if this could be added :)
I guess you try writing your own LifecycleObserver
.
https://developer.android.com/topic/libraries/architecture/lifecycle#lc
https://github.com/greenrobot/EventBus/blob/6348f40f9901f813451791f9d11181be6eb49a32/EventBus/src/org/greenrobot/eventbus/EventBusLifecycleObserver.java#L9-L29
Yea i resorted to LiveData, as I need to send an event from a background thread even if the app is not opend but after reopening the UI has to react to that event, I couldn't really achieve that with EventBus. LiveData isn't the cleanest solution for events, but it is extremely reliable. In my opinion this behavior would also greatly improve EventBus :)