public abstract class BackgroundEventListener extends java.lang.Object implements EventListener
EventListener
and calls processEvent
on a background thread. By default, EventListener calls processEvent on the main thread.
This class is useful for custom analytics implementation, or other types of event handlers
that need to do work on a background thread (typically to make network calls).
When extending this class, destroyBackgroundThread()
must be called when this class
is no longer needed. Otherwise, if this method is not called, the background thread will live on
until the app it is running in, is terminated.Constructor and Description |
---|
BackgroundEventListener() |
Modifier and Type | Method and Description |
---|---|
abstract void |
backgroundProcessEvent(Event event)
Process a given event to some purpose.
|
void |
destroyBackgroundThread()
Stops and destroys the background thread.
|
void |
processEvent(Event event)
Process a given event to some purpose.
|
public final void processEvent(Event event)
EventListener
processEvent
in interface EventListener
event
- The given event.public abstract void backgroundProcessEvent(Event event)
event
- The event to processpublic void destroyBackgroundThread()