コード例 #1
0
    @Override
    public void onPostExecuteManaged(IOCContainer result) {
      if (result == null) {
        final String errorMessage = "Failed to initialize Socialize instance";

        if (listener != null) {
          if (error != null) {
            listener.onError(SocializeException.wrap(error));
          } else {
            listener.onError(new SocializeException(errorMessage));
          }
        } else {
          if (logger != null) {
            if (error != null) {
              logger.error(errorMessage, error);
            } else {
              logger.error(errorMessage);
            }
          } else {
            if (error != null) {
              SocializeLogger.e(errorMessage, error);
            } else {
              System.err.println(errorMessage);
            }
          }
        }
      } else {
        if (listener != null) {
          listener.onInit(context, result);
        }
      }
    }
コード例 #2
0
  public synchronized void init(
      Context context, final IOCContainer container, SocializeInitListener listener) {
    if (!isInitialized()) {
      try {
        this.container = container;

        this.logger = container.getBean("logger");

        this.shareSystem = container.getBean("shareSystem");
        this.userSystem = container.getBean("userSystem");
        this.asserter = container.getBean("initializationAsserter");
        this.authProviders = container.getBean("authProviders");
        this.authProviderInfoBuilder = container.getBean("authProviderInfoBuilder");
        this.notificationChecker = container.getBean("notificationChecker");
        this.appUtils = container.getBean("appUtils");
        this.locationProvider = container.getBean("locationProvider");
        this.listenerHolder = container.getBean("listenerHolder");

        SocializeConfig mainConfig = container.getBean("config");

        mainConfig.merge(config);
        mainConfig.merge(ConfigUtils.preInitConfig);

        this.config = mainConfig;
        this.initCount++;

        verify3rdPartyAuthConfigured();

        // Create the entity loader if we have one
        initEntityLoader();

        // Check we are configured ok
        appUtils.checkAndroidManifest(context);

        ActivityIOCProvider.getInstance().setContainer(container);

        initNotifications(context);

        if (listener != null) {
          listener.onInit(context, container);
        }
      } catch (Exception e) {
        if (logger != null) {
          logger.error(SocializeLogger.INITIALIZE_FAILED, e);
        } else {
          SocializeLogger.e(e.getMessage(), e);
        }
      }
    } else {
      this.initCount++;
    }
  }