public static class AgentConfiguration.Builder
extends java.lang.Object
A class for setting up instances of AgentConfiguration.
Modifier and Type | Method and Description |
---|---|
AgentConfiguration |
build()
Generates the agent configuration based on the parameters passed through the other methods.
|
AgentConfiguration.Builder |
withAppKey(java.lang.String appKey)
Sets the application key used by the SDK.
|
AgentConfiguration.Builder |
withApplicationName(java.lang.String applicationName)
Sets the name of this mobile application.
|
AgentConfiguration.Builder |
withAutoInstrument(boolean enabled)
Boolean value that indicates if automatic instrumentation is enabled.
|
AgentConfiguration.Builder |
withCollectorChannelFactory(CollectorChannelFactory collectorChannelFactory)
Sets the collector channel to use.
|
AgentConfiguration.Builder |
withCollectorURL(java.lang.String collectorURL)
Sets the URL of the collector to which the agent will report.
|
AgentConfiguration.Builder |
withCompileTimeInstrumentationCheck(boolean enabled)
Sets whether a check is performed during initialization to check if compile time instrumentation was successful.
|
AgentConfiguration.Builder |
withContext(android.content.Context context)
Sets the context to be used by the SDK.
|
AgentConfiguration.Builder |
withCrashCallback(CrashReportCallback crashCallback)
Sets the
CrashReportCallback to notify when a crash is reported. |
AgentConfiguration.Builder |
withExcludedUrlPatterns(java.util.Set<java.lang.String> excludedUrlPatterns)
Sets the regex patterns for urls which need to be filtered.
|
AgentConfiguration.Builder |
withInteractionCaptureMode(int interactionCaptureMode)
Sets what types of user interaction events should be captured.
|
AgentConfiguration.Builder |
withJSAgentAjaxEnabled(boolean enable)
Enables or disables JavaScript agent AJAX call reporting.
|
AgentConfiguration.Builder |
withJSAgentInjectionEnabled(boolean enable)
Enables or disables JavaScript agent injection into WebViews.
|
AgentConfiguration.Builder |
withLoggingEnabled(boolean loggingEnabled)
Deprecated.
Instead, use
withLoggingLevel(int) |
AgentConfiguration.Builder |
withLoggingLevel(int loggingLevel)
Sets the logging level of the agent.
|
AgentConfiguration.Builder |
withNetworkRequestCallback(NetworkRequestCallback networkRequestCallback)
Sets the
NetworkRequestCallback to notify when a network request completes and a beacon is about to be sent. |
AgentConfiguration.Builder |
withScreenshotsEnabled(boolean enable)
Enables or disables screenshots.
|
AgentConfiguration.Builder |
withScreenshotURL(java.lang.String screenshotURL)
Sets the URL of the screenshot service to which the agent will upload screenshots.
|
public AgentConfiguration.Builder withAppKey(java.lang.String appKey)
Sets the application key used by the SDK. This is a required property.
public AgentConfiguration.Builder withContext(android.content.Context context)
Sets the context to be used by the SDK. This is a required property. If unsure, use getApplicationContext()
.
public AgentConfiguration.Builder withCollectorURL(java.lang.String collectorURL)
Sets the URL of the collector to which the agent will report. The URL should be compliant with “1.4. Hierarchical URI and Relative Forms” of RFC2396.
This is NOT your controller URL. You likely do not need to call this method unless you have an on-premise EUM Processor.
public AgentConfiguration.Builder withScreenshotURL(java.lang.String screenshotURL)
Sets the URL of the screenshot service to which the agent will upload screenshots. The URL should be compliant with “1.4. Hierarchical URI and Relative Forms” of RFC2396.
This is NOT your controller URL. You likely do not need to call this method unless you have an AppDynamics managed private cloud (very rare).
NOTE: If you have an on-premise EUM Processor and set the collector URL in withCollectorURL(String)
, then you do not need to call this method because the two URLs are the same, and the agent assumes that is the case.
public AgentConfiguration.Builder withApplicationName(java.lang.String applicationName)
Sets the name of this mobile application. If not set, the application name is the package name from the Android Manifest. Most users will not need this.
The parameter applicationName
should follow Java-language-style. It may contain uppercase or lowercase letters (‘A’ through ‘Z’), numbers, and underscores (’_’). Individual package name parts may only start with letters. Reverse-DNS format is recommended.
NOTE: If building AgentConfiguration
with this method, all data reported from this application is associated with applicationName
, and appears together in dashboards.
public AgentConfiguration.Builder withExcludedUrlPatterns(java.util.Set<java.lang.String> excludedUrlPatterns)
Sets the regex patterns for urls which need to be filtered.
Any urls matching one of defined patterns will not be tracked. This field is optional
public AgentConfiguration.Builder withLoggingEnabled(boolean loggingEnabled)
withLoggingLevel(int)
Sets whether info logs are enabled or not. Overwrites any previous value set using withLoggingLevel(int)
.
WARNING: Not recommended for production use.
loggingEnabled
- is logging enabled.public AgentConfiguration.Builder withLoggingLevel(int loggingLevel)
Sets the logging level of the agent. Default is Instrumentation.LOGGING_LEVEL_NONE
. Overwrites any previous value set using withLoggingEnabled(boolean)
.
Possible values are:
Instrumentation.LOGGING_LEVEL_NONE
Instrumentation.LOGGING_LEVEL_INFO
Instrumentation.LOGGING_LEVEL_VERBOSE
WARNING: Not recommended for production use.
java.lang.IllegalArgumentException
- if logging level is invalidpublic AgentConfiguration.Builder withCompileTimeInstrumentationCheck(boolean enabled)
Sets whether a check is performed during initialization to check if compile time instrumentation was successful. Default is enabled.
Compile time instrumentation is required for supporting a number of features such as Network Request reporting, Application Not Responding Reports, Info Points, etc.
By default, agent will throw an exception if you attempt to start it without doing a compile time instrumentation(using one of our build plugins for ant/maven/gradle). You can disable this check by passing in ‘false’.
enabled
- false to disable this check, true to enable (default is enabled)public AgentConfiguration.Builder withAutoInstrument(boolean enabled)
Boolean value that indicates if automatic instrumentation is enabled.
Setting this to false
will disable all automatic instrumentation regardless of any code injection. The following features will also be effected:
interactionCaptureMode
will be set to InteractionCaptureMode.None
enabled
- false
to disable automatic instrumentation, true
to enable (default is enabled)public AgentConfiguration.Builder withInteractionCaptureMode(int interactionCaptureMode)
Sets what types of user interaction events should be captured.
WARNING: Using InteractionCaptureMode.All
means that all currently known and to-be implemented interactions are captured. This could conceivably include personal user information. If you have any concerns around this, we recommend turning on only the interactions you want captured by using the individual specific constants.
interactionCaptureMode
- a bitmask value that indicates a set of interaction events to capturepublic AgentConfiguration.Builder withCollectorChannelFactory(CollectorChannelFactory collectorChannelFactory)
Sets the collector channel to use.
A custom collector channel allows you to have more control over how the SDK communicates with the collector. Most users will not use this mechanism.
public AgentConfiguration.Builder withCrashCallback(CrashReportCallback crashCallback)
Sets the CrashReportCallback
to notify when a crash is reported.
WARNING: This callback is notified on your app’s UI thread, so any long operations should be performed asynchronously.
public AgentConfiguration.Builder withNetworkRequestCallback(NetworkRequestCallback networkRequestCallback)
Sets the NetworkRequestCallback
to notify when a network request completes and a beacon is about to be sent. You may modify the reported object during this callback.
WARNING: This callback is notified on the application thread that the Network Request completes on.
public AgentConfiguration.Builder withScreenshotsEnabled(boolean enable)
Enables or disables screenshots.
Default is enabled.
If enabled, the Instrumentation.takeScreenshot()
method will capture screenshots, and depending on the configuration in the controller, automatic screenshots can be taken. You can always disable screenshots entirely from your controller.
If disabled, the Instrumentation.takeScreenshot()
method will NOT capture screenshots, and no automatic screenshots will be captured. You will NOT be able to enable screenshots from your controller.
Recommended for most applications to leave this option enabled, and control the screenshots from the controller configuration page.
enable
- true to enable screenshots, false to disablepublic AgentConfiguration.Builder withJSAgentInjectionEnabled(boolean enable)
Enables or disables JavaScript agent injection into WebViews. If enabled, JavaScript agent will capture page loads in WebViews.
Default is enabled.
enable
- true to enable JS agent, false to disablepublic AgentConfiguration.Builder withJSAgentAjaxEnabled(boolean enable)
Enables or disables JavaScript agent AJAX call reporting. If enabled, JavaScript agent will capture AJAX calls in WebViews.
Default is disabled. JS Agent injection needs to be enabled for this to have an effect See withJSAgentInjectionEnabled(boolean)
enable
- true to enable JS AJAX reporting, false to disablepublic AgentConfiguration build()
Generates the agent configuration based on the parameters passed through the other methods.
java.lang.NullPointerException
- if a required parameter is null.