Class ConfigurationBuilder
- java.lang.Object
-
- com.dynatrace.android.agent.conf.ConfigurationBuilder
-
- Direct Known Subclasses:
AppMonConfigurationBuilder
,DynatraceConfigurationBuilder
public class ConfigurationBuilder extends Object
This class is needed for generating the agentConfiguration
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description com.dynatrace.android.agent.conf.Configuration
buildConfiguration()
Builds the agent configuration object.ConfigurationBuilder
withActivityMonitoring(boolean enabled)
Enables/disables lifecycle monitoring for the classActivity
.ConfigurationBuilder
withAutoUserActionModifier(UserActionModifier modifier)
Sets aUserActionModifier
that is invoked each time a new user action is created via auto-instrumentation.ConfigurationBuilder
withCertificateValidation(boolean enabled)
Deprecated.As of version 8.257, instead provide a proper certificate to the applications Network Security Configuration.ConfigurationBuilder
withCommunicationProblemListener(CommunicationProblemListener listener)
Sets aCommunicationProblemListener
that will be asynchronously notified when the agent can't successfully communicate with the beacon.ConfigurationBuilder
withCrashReporting(boolean enabled)
Enables/disables crash reporting.ConfigurationBuilder
withDebugLogging(boolean enabled)
Enables/disables debug logging.ConfigurationBuilder
withHybridMonitoring(boolean enabled)
Enables/disables the hybrid monitoring feature.ConfigurationBuilder
withKeyManagers(KeyManager[] keyManagers)
Deprecated.As of version 8.257, no replacementConfigurationBuilder
withKeyStore(KeyStore keyStore)
Deprecated.As of version 8.257, instead add your self-signed certificate to the Network Security Configuration.ConfigurationBuilder
withMonitoredDomains(String... monitoredDomains)
For hybrid applications using the JavaScript library, cookies need to be set for each instrumented domain or server the application communicates with.ConfigurationBuilder
withMonitoredHttpsDomains(String... monitoredHttpsDomains)
For hybrid applications using the JavaScript library, cookies need to be set for each instrumented domain or server the application communicates with.ConfigurationBuilder
withStartupLoadBalancing(boolean enabled)
Enables/disables advanced load balancing for the agent startup.ConfigurationBuilder
withUserOptIn(boolean enabled)
Enables/disables the user opt-in feature.
-
-
-
Method Detail
-
withCertificateValidation
@Deprecated public ConfigurationBuilder withCertificateValidation(boolean enabled)
Deprecated.As of version 8.257, instead provide a proper certificate to the applications Network Security Configuration.Enables/disables certificate validation.WARNING: If the certificate validation is deactivated, the agent will not verify the server certificate and therefore the agent communication is vulnerable to malicious attacks.
Do not deactivate certificate validation in production.
The default value is
true
.- Parameters:
enabled
- the certificate validation flag- Returns:
- this
ConfigurationBuilder
object (for usage as fluent API) - See Also:
- Network Security Configuration
-
withKeyStore
@Deprecated public ConfigurationBuilder withKeyStore(KeyStore keyStore)
Deprecated.As of version 8.257, instead add your self-signed certificate to the Network Security Configuration.Allows the agent to verify self-signed certificates.With Android SDK 24, this feature became obsolete. Please use the Network Security Configuration instead.
- Parameters:
keyStore
- the key store holding the certificate(s) for SSL communications- Returns:
- this
ConfigurationBuilder
object (for usage as fluent API) - See Also:
- Network Security Configuration
-
withKeyManagers
@Deprecated public ConfigurationBuilder withKeyManagers(KeyManager[] keyManagers)
Deprecated.As of version 8.257, no replacementAllows the agent to use client certificates.Has to be used in combination with the method
withKeyStore(KeyStore)
.- Parameters:
keyManagers
- an array of key managers.- Returns:
- this
ConfigurationBuilder
object (for usage as fluent API) - See Also:
withKeyStore(KeyStore)
-
withMonitoredDomains
public ConfigurationBuilder withMonitoredDomains(String... monitoredDomains)
For hybrid applications using the JavaScript library, cookies need to be set for each instrumented domain or server the application communicates with.Specify domains, hosts or IP addresses. Domains or sub-domains must start with a dot.
- To set a domain-level cookie, use .company.com
- To set a subdomain-level cookie, use .subdomain.company.com
- To set a server-specific cookie, use server.company.com
- To set a cookie for an IP address, use the IP address of that system
- Parameters:
monitoredDomains
- a list of domains, hosts or IP addresses- Returns:
- this
ConfigurationBuilder
object (for usage as fluent API) - See Also:
withHybridMonitoring(boolean)
-
withMonitoredHttpsDomains
public ConfigurationBuilder withMonitoredHttpsDomains(String... monitoredHttpsDomains)
For hybrid applications using the JavaScript library, cookies need to be set for each instrumented domain or server the application communicates with.You can specify domains, host or IP addresses. Domains or sub-domains must start with a dot. Domains added here will create secure cookies.
- To set a domain-level cookie, use https://.company.com
- To set a subdomain-level cookie, use https://.subdomain.company.com
- To set a server-specific cookie, use https://server.company.com
- To set a cookie for an IP address, use the IP address of that system plus https://
- Parameters:
monitoredHttpsDomains
- a list of domains, hosts or IP addresses- Returns:
- this
ConfigurationBuilder
object (for usage as fluent API) - Since:
- 8.232
- See Also:
withHybridMonitoring(boolean)
-
withHybridMonitoring
public ConfigurationBuilder withHybridMonitoring(boolean enabled)
Enables/disables the hybrid monitoring feature.The default value is
false
.- Parameters:
enabled
- the hybrid monitoring flag- Returns:
- this
ConfigurationBuilder
object (for usage as fluent API)
-
withDebugLogging
public ConfigurationBuilder withDebugLogging(boolean enabled)
Enables/disables debug logging.WARNING: Do NOT activate debug logging for your production apps.
- Parameters:
enabled
- the debug logging flag- Returns:
- this
ConfigurationBuilder
object (for usage as fluent API)
-
withUserOptIn
public ConfigurationBuilder withUserOptIn(boolean enabled)
Enables/disables the user opt-in feature.This feature allows the user to dynamically adjust the privacy settings.
The default value is
false
.- Parameters:
enabled
- the user opt-in flag- Returns:
- this
ConfigurationBuilder
object (for usage as fluent API)
-
withStartupLoadBalancing
public ConfigurationBuilder withStartupLoadBalancing(boolean enabled)
Enables/disables advanced load balancing for the agent startup.The default value is
false
.- Parameters:
enabled
- true, if advanced load balancing for the startup should be enabled- Returns:
- this
ConfigurationBuilder
object (for usage as fluent API) - Since:
- 8.203
-
withCrashReporting
public ConfigurationBuilder withCrashReporting(boolean enabled)
Enables/disables crash reporting.If enabled, the agent captures all uncaught exceptions and errors. The captured crashes will be sent immediately to the server and will pass the exception to the previous default uncaught exception handler.
The default value is
false
.- Parameters:
enabled
- true, if crashes should be reported- Returns:
- this
ConfigurationBuilder
object (for usage as fluent API)
-
withCommunicationProblemListener
public ConfigurationBuilder withCommunicationProblemListener(CommunicationProblemListener listener)
Sets aCommunicationProblemListener
that will be asynchronously notified when the agent can't successfully communicate with the beacon.If a
CommunicationProblemListener
is used, the agent will not reconnect to the beacon endpoint, when the communication fails with an invalid response code.- Parameters:
listener
- the object that should be notified- Returns:
- this
ConfigurationBuilder
object (for usage as fluent API)
-
withActivityMonitoring
public ConfigurationBuilder withActivityMonitoring(boolean enabled)
Enables/disables lifecycle monitoring for the classActivity
.If enabled, the agent will monitor the lifecycle events of activities.
The default value is
true
.- Parameters:
enabled
- true, if lifecycle events of activities should be monitored- Returns:
- this
ConfigurationBuilder
object (for usage as fluent API) - Since:
- 8.223
-
withAutoUserActionModifier
public ConfigurationBuilder withAutoUserActionModifier(UserActionModifier modifier)
Sets aUserActionModifier
that is invoked each time a new user action is created via auto-instrumentation.It is not invoked for user actions created manually via
Dynatrace.enterAction(String)
.- Parameters:
modifier
- modifications that should be applied to the newly created user action- Returns:
- this
ConfigurationBuilder
object (for usage as fluent API) - Since:
- 8.241
-
buildConfiguration
public com.dynatrace.android.agent.conf.Configuration buildConfiguration()
Builds the agent configuration object.- Returns:
- the agent configuration or null, if the configuration is invalid
-
-