public static class YandexMetricaConfig.Builder
extends java.lang.Object
YandexMetricaConfig object.| Modifier | Constructor and Description |
|---|---|
protected |
Builder(java.lang.String apiKey) |
| Modifier and Type | Method and Description |
|---|---|
YandexMetricaConfig |
build()
Creates instance of
YandexMetricaConfig |
YandexMetricaConfig.Builder |
handleFirstActivationAsUpdate(boolean value)
Whether first activation of AppMetrica should be considered as app update or new app install.
|
YandexMetricaConfig.Builder |
withAppVersion(java.lang.String appVersion)
Sets the application version.
|
YandexMetricaConfig.Builder |
withCrashReporting(boolean enabled)
Whether to capture and send reports about crashes automatically.
|
YandexMetricaConfig.Builder |
withErrorEnvironmentValue(java.lang.String key,
java.lang.String value)
Sets key - value data to be used as additional information, associated
with your unhandled exception and error reports.
|
YandexMetricaConfig.Builder |
withInstalledAppCollecting(boolean enabled)
Deprecated.
Set value will always be ignored (considered false).
By default, installed apps list is collected to improve statistics quality.
NOTE: Default value is false.
|
YandexMetricaConfig.Builder |
withLocation(android.location.Location location)
Sets
Location to be used as location for reports of AppMetrica. |
YandexMetricaConfig.Builder |
withLocationTracking(boolean enabled)
Sets whether AppMetrica should include location information within its reports.
|
YandexMetricaConfig.Builder |
withLogs()
Enable AppMetrica logging.
|
YandexMetricaConfig.Builder |
withMaxReportsInDatabaseCount(int value)
Sets maximum number of reports to store in database.
|
YandexMetricaConfig.Builder |
withNativeCrashReporting(boolean enabled)
Whether to capture and send reports about native crashes automatically.
|
YandexMetricaConfig.Builder |
withPreloadInfo(PreloadInfo preloadInfo)
Sets
preload info for tracking preloaded apps |
YandexMetricaConfig.Builder |
withSessionTimeout(int sessionTimeout)
By default, the session times out if the app is inactive for
YandexMetricaDefaultValues.DEFAULT_SESSION_TIMEOUT_SECONDS seconds. |
YandexMetricaConfig.Builder |
withStatisticsSending(boolean value)
Enables/disables statistics sending to the AppMetrica server.
|
YandexMetricaConfig.Builder |
withUserProfileID(java.lang.String userProfileID)
Sets the ID of the user profile.
|
@NonNull public YandexMetricaConfig.Builder withAppVersion(@Nullable java.lang.String appVersion)
android:versionName of
the
AndroidManifest.xml file.
EXAMPLE: 1.0
appVersion - Application versionYandexMetricaConfig.Builder object.java.lang.IllegalArgumentException - If appVersion is null/empty.PackageInfo.versionName@NonNull public YandexMetricaConfig.Builder withSessionTimeout(int sessionTimeout)
YandexMetricaDefaultValues.DEFAULT_SESSION_TIMEOUT_SECONDS seconds.
To change this time limit, pass the builder.withSessionTimeout(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 AppMetrica, means the following (see example):
EXAMPLE: Let the duration of sessions 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.
sessionTimeout - Timeout in seconds.YandexMetricaConfig.Builder object.@NonNull public YandexMetricaConfig.Builder withCrashReporting(boolean enabled)
NOTE: Default value is
YandexMetricaDefaultValues.DEFAULT_REPORTS_CRASHES_ENABLED
enabled - true if we need to send reports about crashes,
otherwise false. In the case of false you can still send
information about crashes via YandexMetrica.reportUnhandledException(Throwable) method.YandexMetricaConfig.Builder object.(boolean)@NonNull public YandexMetricaConfig.Builder withNativeCrashReporting(boolean enabled)
NOTE: Default value is
YandexMetricaDefaultValues.DEFAULT_REPORTS_NATIVE_CRASHES_ENABLED
enabled - true if we need to send reports about native crashes,
otherwise false. In the case of false you can still send
information about native crashes via YandexMetrica.reportNativeCrash(String) method.YandexMetricaConfig.Builder object.withCrashReporting(boolean)@NonNull public YandexMetricaConfig.Builder withLogs()
YandexMetricaConfig.Builder object.@NonNull public YandexMetricaConfig.Builder withLocation(@Nullable android.location.Location location)
Location to be used as location for reports of AppMetrica.If location is set using this method, it will be used instead of auto collected location.
NOTE: Permissions:
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION
improve the quality of auto collected location.
location - location to be used for reportsYandexMetricaConfig.Builder object.withLocationTracking(boolean),
YandexMetrica.setLocation(Location),
YandexMetrica.setLocationTracking(boolean)@NonNull public YandexMetricaConfig.Builder withLocationTracking(boolean enabled)
NOTE: Default value is
YandexMetricaDefaultValues.DEFAULT_REPORT_LOCATION_ENABLED
enabled - true to allow Yandex Metrica to record location information in reports,
otherwise false.YandexMetricaConfig.Builder object.withLocation(Location),
YandexMetrica.setLocationTracking(boolean),
YandexMetrica.setLocation(Location)@NonNull public YandexMetricaConfig.Builder withInstalledAppCollecting(boolean enabled)
enabled - whether installed apps list should be collected.YandexMetricaConfig.Builder object.@NonNull public YandexMetricaConfig.Builder withPreloadInfo(@Nullable PreloadInfo preloadInfo)
preload info for tracking preloaded appspreloadInfo - instance of PreloadInfoYandexMetricaConfig.Builder object@NonNull public YandexMetricaConfig.Builder handleFirstActivationAsUpdate(boolean value)
value - true if first call of YandexMetrica.activate(android.content.Context, com.yandex.metrica.YandexMetricaConfig) should be considered as app update,
false otherwise.YandexMetricaConfig.Builder object@NonNull public YandexMetricaConfig.Builder withStatisticsSending(boolean value)
NOTE: Disabling this option also turns off data sending from the reporters that initialized for different apiKey.
value - true to allow AppMetrica sending statistics,
otherwise false.YandexMetricaConfig.Builder object@NonNull public YandexMetricaConfig.Builder withMaxReportsInDatabaseCount(int value)
NOTE:
Default value is YandexMetricaDefaultValues.DEFAULT_MAX_REPORTS_IN_DATABASE_COUNT
value - 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.YandexMetricaConfig.Builder object.@NonNull public YandexMetricaConfig.Builder withErrorEnvironmentValue(@NonNull java.lang.String key, @Nullable java.lang.String value)
key - the environment key.value - the environment value. To remove pair from environment pass null value.YandexMetricaConfig.Builder object@NonNull public YandexMetricaConfig.Builder withUserProfileID(@Nullable java.lang.String userProfileID)
userProfileID - The custom user profile ID.YandexMetricaConfig.Builder objectYandexMetrica.setUserProfileID(String)@NonNull public YandexMetricaConfig build()
YandexMetricaConfigYandexMetricaConfig object