I have been searching for perfect android application architecture and read a few great blogposts on this topic.
1) http://www.mdswanson.com/blog/2014/04/07/durable-android-rest-clients.html
2) http://birbit.com/a-recipe-for-writing-responsive-rest-clients-on-android/
Both posts describe how to utilize event bus for communication among android components (activity, fragments, service).
One, but very important topic was not covered. How to handle events which were posted to UI components when they were paused.
For example: service is posting event on completion of downloading data to activity. And at this moment activity is paused. As event bus is being unregistered in onPause(), we are loosing this event completely.
EvenBus from greendao offers stickyevents. But they can cause memory leaks if not removed.
Otto from square introduces "Producer" pattern, which can be used instead of sticky events.
First solution can cause memory leaks if sticky event is not removed manually.
The second requires to keep data somewhere until Producer method returns it to Subscribers. This solution seems to be more correct, but requires to write more code.
Could anyone please share with ideas how to tackle this edge case? Any clean solutions?