Recently I became aware of EventBus Library. Basically my use case revolves around a service and an Activity.
Service is used for tracking the changes in the BLE connection.
Activity is used for reporting that connection state to the UI.
How can I achieve the same using the library..
In your Activity's
onResume
method, register for events:And unregister at
onPause
When service is running and it obtains info regarding BLE, send this info through EventBus:
Finally, implement the activity's behavior for getting the info: