code: public void onDestroy(@Nullable Activity activity) {
      // We need to track whether the current Activity is finishing or not in order to decide if we
      // should destroy the ObservableGroup. If the Activity is not finishing, then we should not
      // destroy it, since we know that we're probably restoring state at some point and reattaching
      // to the existing ObservableGroup. If saveState() was not called, then it's likely that we're
      // being destroyed and are not ever coming back. However, this isn't perfect, especially
      // when using fragments in a ViewPager. We might want to allow users to explicitly destroy it
      // instead, in order to mitigate this issue.
      // Also in some situations it seems like an Activity can be recreated even though its
      // isFinishing() property is set to true. For this reason, we must also check
      // isChangingConfigurations() to make sure it's safe to destroy the group.
      onDestroy(!hasSavedState
          || (activity != null && activity.isFinishing() && !activity.isChangingConfigurations()));
    }
docs: Call this method from your Activity or Fragment's onDestroy method