@Override
  public void onActivityCreated(Bundle savedInstanceState) {

    setRetainInstance(true);
    alfSession = SessionUtils.getSession(getActivity());
    if (RepositoryVersionHelper.isAlfrescoProduct(alfSession)) {
      setActivateThumbnail(true);
    }
    super.onActivityCreated(savedInstanceState);
  }
  /** @see org.alfresco.mobile.android.api.session.RepositorySession#authenticate(String, String) */
  private void authenticate() {
    // default factory implementation
    SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
    Map<String, String> param = retrieveSessionParameters();

    cmisSession = createSession(sessionFactory, param);

    // Check RepositoryInfo for Alfresco Version
    // If Alfresco is not a V4, bind with CMIS webscript implementation
    boolean isAlfresco =
        cmisSession
            .getRepositoryInfo()
            .getProductName()
            .startsWith(OnPremiseConstant.ALFRESCO_VENDOR);
    String version =
        RepositoryVersionHelper.getVersionString(
            cmisSession.getRepositoryInfo().getProductVersion(), 0);

    RepositoryInfo tmpRepositoryInfo =
        new OnPremiseRepositoryInfoImpl(cmisSession.getRepositoryInfo());

    if (isAlfresco
        && !hasForceBinding()
        && version != null
        && Integer.parseInt(version) >= OnPremiseConstant.ALFRESCO_VERSION_4) {
      param.put(
          SessionParameter.ATOMPUB_URL, baseUrl.concat(OnPremiseUrlRegistry.BINDING_CMISATOM));
      Session cmisSession2 = null;
      try {
        cmisSession2 = createSession(sessionFactory, param);
      } catch (Exception e) {
        cmisSession2 = null;
      }
      cmisSession = (cmisSession2 != null) ? cmisSession2 : cmisSession;
    }

    // Init Services + Object
    rootNode = new FolderImpl(cmisSession.getRootFolder());

    repositoryInfo = new OnPremiseRepositoryInfoImpl(cmisSession.getRepositoryInfo());

    // On cmisatom binding sometimes the edition is not well formated. In
    // this case we use service/cmis binding. MOBSDK-508
    if (repositoryInfo.getEdition() == OnPremiseConstant.ALFRESCO_EDITION_UNKNOWN
        && tmpRepositoryInfo.getEdition() != OnPremiseConstant.ALFRESCO_EDITION_UNKNOWN) {
      repositoryInfo =
          new OnPremiseRepositoryInfoImpl(
              cmisSession.getRepositoryInfo(), tmpRepositoryInfo.getEdition());
    }

    // Extension Point to implement and manage services
    create();
  }
  // //////////////////////////////////////////////////////////////////////
  // LIFE CYCLE
  // //////////////////////////////////////////////////////////////////////
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    setRetainInstance(true);
    alfSession = SessionUtils.getSession(getActivity());
    SessionUtils.checkSession(getActivity(), alfSession);
    if (alfSession == null) {

    } else if (RepositoryVersionHelper.isAlfrescoProduct(alfSession)) {
      setActivateThumbnail(true);
    }

    // In case of Import mode, we disable thumbnails.
    if (getActivity() instanceof PublicDispatcherActivity) {
      mode = MODE_IMPORT;
      setActivateThumbnail(false);
    } else if (getActivity() instanceof PrivateDialogActivity) {
      mode = MODE_PICK;
      fragmentPick = ((PrivateDialogActivity) getActivity()).getOnPickDocumentFragment();
    }

    super.onActivityCreated(savedInstanceState);
  }