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 agent Configuration.
See Also:
  • Method Details

    • 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:
    • 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:
    • withKeyManagers

      @Deprecated public ConfigurationBuilder withKeyManagers(KeyManager[] keyManagers)
      Deprecated.
      As of version 8.257, no replacement
      Allows 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:
    • 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:
    • 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.237
      See Also:
    • 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)
    • withFileDomainCookies

      public ConfigurationBuilder withFileDomainCookies(boolean fileDomainCookies)
      Enables/disables file scheme cookies and automatically adds the cookies to the file:// domain.

      The default value is true.

      Parameters:
      fileDomainCookies - true, if file domain cookies should be enabled
      Returns:
      this ConfigurationBuilder object (for usage as fluent API)
      Since:
      8.271
    • 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 a CommunicationProblemListener 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 class Activity.

      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 a UserActionModifier 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