Refactored the global listener pattern.

Previously the SDK only held weak references to listeners. The
problem was then that anonymous listener implementations were
garbage collected even before they were used, resulting in events
not reaching their targets.

The current implementation is now holding hard references to the
listeners instead. The remote implication of this is that there is
now a remote chance of the SDK preventing large memory chunks from
being garbage collected. This would be the case where, say, an
Android Activity is implementing a callback interface.