public interface LifecycleService
Example
Services.get(LifecycleService.class).ifPresent(service -> {
service.addListener(LifecycleEvent.PAUSE, () -> System.out.println("Application is paused."));
service.addListener(LifecycleEvent.RESUME, () -> System.out.println("Application is resumed."));
});
Android Configuration: none
iOS Configuration: none
LifecycleEvent
Modifier and Type | Method and Description |
---|---|
void |
addListener(LifecycleEvent lifecycleEvent,
java.lang.Runnable eventHandler)
Adds a life cycle event listener to the native platform, to be notified of
LifecycleEvent events. |
void |
removeListener(LifecycleEvent lifecycleEvent,
java.lang.Runnable eventHandler)
Removes a previously installed event handler.
|
void |
shutdown()
Initiates the process of shutting down the application that called this method.
|
void addListener(LifecycleEvent lifecycleEvent, java.lang.Runnable eventHandler)
LifecycleEvent
events.lifecycleEvent
- The type of event to listen for.eventHandler
- The event handler that will be called when the event fires.void removeListener(LifecycleEvent lifecycleEvent, java.lang.Runnable eventHandler)
lifecycleEvent
- The type of event that was being listened to.eventHandler
- The event handler that should be removed.void shutdown()