Class AppLifecycleCallbackHandler

  • All Implemented Interfaces:
    android.app.Application.ActivityLifecycleCallbacks

    
    public final class AppLifecycleCallbackHandler
     implements Application.ActivityLifecycleCallbacks
                        

    This class keeps track of the application's current activity. <B>It is important to register this callback, otherwise the authentication interceptors will not be able to handle challenges properly!</B> The recommended way to register this callback is by overriding android.app.Application and calling registerActivityLifecycleCallbacks from onCreate.

    <pre> public class SampleApplication extends Application {
    • Constructor Detail

    • Method Detail

      • isInForeground

         final Boolean isInForeground()

        Returns true if the application is visible.

        Note that if this method is called from another registered android.app.Application.ActivityLifecycleCallbacks method the return value will be unreliable since the order the android.app.Application.ActivityLifecycleCallbacks will be called is unknown. Instead, other android.app.Application.ActivityLifecycleCallbacks should use their own callback methods to track the application's state.

        Returns:

        true if the application is visible, false otherwise.

      • getActivity

         final Activity getActivity()

        Provides the current activity. The activity is stored by this class with a weak reference, so this method may return null.

        Returns:

        The topmost activity of this application, or null.