void waitForConfiguration(final ConfigurationListener listener) {
    if (getConfiguration() == null
        && !ConfigurationManager.isFetchingConfiguration()
        && mAuthorization != null) {
      fetchConfiguration();
    }

    postOrQueueCallback(
        new QueuedCallback() {
          @Override
          public boolean shouldRun() {
            return getConfiguration() != null;
          }

          @Override
          public void run() {
            listener.onConfigurationFetched(getConfiguration());
          }
        });
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRetainInstance(true);

    mContext = getActivity().getApplicationContext();
    mCrashReporter = CrashReporter.setup(mContext);
    mIntegrationType = getArguments().getString(EXTRA_INTEGRATION_TYPE);
    mAuthorization = getArguments().getParcelable(EXTRA_AUTHORIZATION_TOKEN);

    if (mHttpClient == null) {
      mHttpClient = new BraintreeHttpClient(mAuthorization);
    }

    if (savedInstanceState != null) {
      List<PaymentMethodNonce> paymentMethodNonces =
          savedInstanceState.getParcelableArrayList(EXTRA_CACHED_PAYMENT_METHOD_NONCES);
      if (paymentMethodNonces != null) {
        mCachedPaymentMethodNonces.addAll(paymentMethodNonces);
      }

      mHasFetchedPaymentMethodNonces =
          savedInstanceState.getBoolean(EXTRA_FETCHED_PAYMENT_METHOD_NONCES);
      mIsBrowserSwitching = savedInstanceState.getBoolean(EXTRA_BROWSER_SWITCHING);
      mSessionId = savedInstanceState.getString(EXTRA_SESSION_ID);
    } else {
      mSessionId = DeviceMetadata.getFormattedUUID();
      if (mAuthorization instanceof TokenizationKey) {
        sendAnalyticsEvent("started.client-key");
      } else {
        sendAnalyticsEvent("started.client-token");
      }
    }

    fetchConfiguration();
    mCrashReporter.sendPreviousCrashes(this);
  }