Package 

Interface LifecycleEventListener


  • 
    public interface LifecycleEventListener
    
                        

    Listener for receiving activity lifecycle events.

    When multiple activities share a react instance, only the most recent one's lifecycle events get forwarded to listeners. Consider the following scenarios:

    • Navigating from Activity A to B will trigger two events: A#onHostPause and B#onHostResume. Any subsequent lifecycle events coming from Activity A, such as onHostDestroy, will be ignored.
    • Navigating back from Activity B to Activity A will trigger the same events: B#onHostPause and A#onHostResume. Any subsequent events coming from Activity B, such as onHostDestroy, are ignored.
    • Navigating back from Activity A to a non-React Activity or to the home screen will trigger two events: onHostPause and onHostDestroy.
    • Navigating from Activity A to a non-React Activity B will trigger one event: onHostPause. Later, if Activity A is destroyed (e.g. because of resource contention), onHostDestroy is triggered.
    • Method Summary

      Modifier and Type Method Description
      abstract void onHostResume() Called either when the host activity receives a resume event (e.g.
      abstract void onHostPause() Called when host activity receives pause event (e.g.
      abstract void onHostDestroy() Called when host activity receives destroy event (e.g.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • onHostResume

         abstract void onHostResume()

        Called either when the host activity receives a resume event (e.g. onResume orif the native module that implements this is initialized while the host activity is alreadyresumed. Always called for the most current activity.

      • onHostPause

         abstract void onHostPause()

        Called when host activity receives pause event (e.g. onPause. Always calledfor the most current activity.

      • onHostDestroy

         abstract void onHostDestroy()

        Called when host activity receives destroy event (e.g. onDestroy. Only calledfor the last React activity to be destroyed.