code: private void initialiseLifecycleObserver(Application application) {
          LifeCycleController.registerLifeCycleObserver(application, new LifecycleListener() {
              @Override
              public void onForegrounded(Context context) {
                  for (LifecycleListener listener : lifecycleListeners) {
                      listener.onForegrounded(context);
                  }
              }
  
              @Override
              public void onBackgrounded(Context context) {
                  for (LifecycleListener listener : lifecycleListeners) {
                      listener.onBackgrounded(context);
                  }
              }
          });
      }
docs: Register for application lifecycle callbacks.
  
  @param application Application instance.