Class ReporterConfig.Builder

java.lang.Object
com.yandex.metrica.ReporterConfig.Builder
Enclosing class:
ReporterConfig

public static class ReporterConfig.Builder
extends java.lang.Object
  • Method Details

    • withSessionTimeout

      @NonNull public ReporterConfig.Builder withSessionTimeout​(int sessionTimeout)
      Set the timeout for expiring session.

      By default, the session times out if the app is inactive for 10 seconds. To change this time limit, pass to the IReporter.setSessionTimeout(int sessionTimeoutSeconds) method your time limit in seconds. The minimum acceptable value for the sessionTimeoutSeconds parameter is 10 seconds. If a value less than 10 is set, the value will automatically be 10 seconds.

      Under the duration of sessions, in the concept of Metrica, means the following (see example):

      EXAMPLE: Let the duration of session timeout is 2 minutes. Then, if interaction with your application started after 2 minutes of inactivity with the application, then a new session will be created, otherwise the session will continue.

      Parameters:
      sessionTimeout - Timeout in seconds.
      Returns:
      the same ReporterConfig.Builder object.
    • withLogs

      @NonNull public ReporterConfig.Builder withLogs()
      Enable logging for appropriate IReporter. Should be called before YandexMetrica.getReporter(Context, String).
      Returns:
      the same ReporterConfig.Builder object.
    • withStatisticsSending

      @NonNull public ReporterConfig.Builder withStatisticsSending​(boolean enabled)
      Enables/disables statistics sending to the AppMetrica server. By default, the sending is enabled.

      NOTE: Disabling this option doesn't affect data sending from the main apiKey and other reporters.

      Parameters:
      enabled - true to allow AppMetrica sending statistics, otherwise false.
      Returns:
      the same ReporterConfig.Builder object.
    • withMaxReportsInDatabaseCount

      @NonNull public ReporterConfig.Builder withMaxReportsInDatabaseCount​(int maxReportsInDatabaseCount)
      Sets maximum number of reports to store in database. If this number is exceeded, some reports will be removed.

      NOTE: Default value is YandexMetricaDefaultValues.DEFAULT_MAX_REPORTS_IN_DATABASE_COUNT

      Parameters:
      maxReportsInDatabaseCount - Max number of reports to store in database. Must be in range [YandexMetricaDefaultValues.DEFAULT_MAX_REPORTS_COUNT_LOWER_BOUND; YandexMetricaDefaultValues.DEFAULT_MAX_REPORTS_COUNT_UPPER_BOUND]. If not, closest possible value will be used.
      Returns:
      the same ReporterConfig.Builder object.
    • withUserProfileID

      @NonNull public ReporterConfig.Builder withUserProfileID​(@Nullable java.lang.String userProfileID)
      Sets the ID of the user profile. NOTE: The string value can contain up to 200 characters.
      Parameters:
      userProfileID - The custom user profile ID.
      Returns:
      the same YandexMetricaConfig.Builder object
      See Also:
      YandexMetrica.setUserProfileID(String)
    • build

      @NonNull public ReporterConfig build()
      Creates instance of ReporterConfig
      Returns:
      ReporterConfig object