I am using EventBus in my application, in which I have one question how it will execute?
I have registered receiver in application, activity and fragment
What I want in app:
Receive message in application class and make some modification and then send it to fragment or activity
Now my question is:
- Is eventbus has specific sequence to receive message? like : fragment -> activity -> application
- If it has then in which sequence it will execute? a : fragment -> activity -> application b : application -> fragment -> activity c : randomly
- And finally how can I receive message in application and then send to fragment or activity by using same messageEvent model class
EventBusdo have sequence of delivery but not by default, while subscribing toEventBusyou can set thepriorityusing@Subscribe(priority = 0), higher priority subscribers will receive the message first which are on same thread policy. But subscribers are the end point of any transmission meaning modifications done to data in one subscriber won't be sent automatically to another subscriber. To achieve what you need, you can only register primary subscriber asApplication, then transform data and broadcast it again with different arguments which the Fragment/Activity will subscribe to.