Sep 16, 2015

Android Event Bus

We've used Otto for event notification. If you're not familiar with this, it allows your application to subscribe to events and other parts of your application to listed for when those events are fired. Otto was okay for awhile, and still is. It comes with one major caveat - new Android developers don't realize they need to unregister() off the bus when the lifecycle of the view is over - this creates a memory leaks on apps with more than one Activity or Fragment, which causes apps to eventually crash.

One of the items I've been waiting for is either the ability for Otto to get a bit smarter and allow the user to register as a weak reference. A new library, EventBus (also boasting faster performance) has emerged, and one of the outstanding feature requests is to enable this very feature. Hasn't been implemented yet, but something I've subscribed to and am interested in seeing implemented.

No comments:

Post a Comment