Class ReporterConfig.Builder
- Enclosing class:
- ReporterConfig
ReporterConfig
object.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates instance ofReporterConfig
withAdditionalConfig
(String key, Object config) Sets key - config datawithAppEnvironmentValue
(String key, String value) Sets key - value pair to be used as additional information, associated with your application runtime's environment.withDataSendingEnabled
(boolean enabled) Enables/disables data sending to the AppMetrica server.withDispatchPeriodSeconds
(int dispatchPeriodSeconds) Timeout of events sending if the number of events is less thanReporterConfig.maxReportsCount
.withLogs()
Enable logging for appropriateIReporter
.withMaxReportsCount
(int maxReportsCount) Sets maximum buffer size for reports.withMaxReportsInDatabaseCount
(int maxReportsInDatabaseCount) Sets maximum number of reports to store in database.withSessionTimeout
(int sessionTimeout) Set the timeout for expiring session.withUserProfileID
(String userProfileID) Sets the ID of the user profile.
-
Method Details
-
withSessionTimeout
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
Enable logging for appropriateIReporter
. Should be called beforeAppMetrica.getReporter(Context, String)
.- Returns:
- the same
ReporterConfig.Builder
object.
-
withDataSendingEnabled
Enables/disables data 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 data, otherwisefalse
.- Returns:
- the same
ReporterConfig.Builder
object.
-
withMaxReportsInDatabaseCount
Sets maximum number of reports to store in database. If this number is exceeded, some reports will be removed.NOTE: Default value is 1000
- Parameters:
maxReportsInDatabaseCount
- Max number of reports to store in database. Must be in range [100; 10000]. If not, closest possible value will be used.- Returns:
- the same
ReporterConfig.Builder
object.
-
withUserProfileID
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
ReporterConfig.Builder
object - See Also:
-
withMaxReportsCount
Sets maximum buffer size for reports.NOTE: Default value is 7. If you set a non-positive value, then automatic sending will be disabled for the situation when the events buffer is full.
- Parameters:
maxReportsCount
- Max number of items/reports to automatically send reports.- Returns:
- the same
ReporterConfig.Builder
object. - See Also:
-
withDispatchPeriodSeconds
Timeout of events sending if the number of events is less thanReporterConfig.maxReportsCount
.NOTE: Default value is 90. If you set a non-positive value, then automatic sending by timer will be disabled.
- Parameters:
dispatchPeriodSeconds
- Timeout in seconds to automatically send reports.- Returns:
- the same
ReporterConfig.Builder
object. - See Also:
-
withAppEnvironmentValue
Sets key - value pair to be used as additional information, associated with your application runtime's environment. This environment is unique for every unique APIKey and shared between processes. Application's environment persists to storage and retained between application launches. To reset environment use Pairs added to config builder, will be set right after metrica initialization.WARNING: Application's environment is a global permanent state and can't be changed too often. For frequently changed parameters use extended reportMessage methods.
- Parameters:
key
- the environment key.value
- the environment value. To remove pair from environment passnull
value.- Returns:
- the same object
-
withAdditionalConfig
@NonNull public ReporterConfig.Builder withAdditionalConfig(@NonNull String key, @Nullable Object config) Sets key - config data- Parameters:
key
- the config key.config
- the config value.- Returns:
- the same
ReporterConfig.Builder
object.
-
build
Creates instance ofReporterConfig
- Returns:
ReporterConfig
object
-