The Android agent provides configuration settings to change the default behavior of the agent. For an explanation of mobile custom data types, see Add custom data to mobile monitoring.
Change configuration settings
All settings, including the call to invoke the agent, are called in the onCreate method of the MainActivity class. To change settings, call the setting in one of two ways (if the setting supports it):
Change the setting on its own line for each specific condition:
Enable or disable the reporting of event data. Event collection will still occur; the events will just not be sent to our collector. You might decide to use this instead of withAnalyticsEvents if you wanted to disable collection but still be able to see what the agent was collecting.
Type
Boolean
Default
true
Application settings
Set custom application version strings.
Type
String
Default
Defaults to version number set in AndroidManifest.xml
Enable or disable recording handled exceptions events, which appear on the Handled exception page.
Type
Boolean
Default
true
Enable or disable recording of native runtime crashes, exceptions and Application Not Responding (ANR) conditions, which appear on the Crash Analysis page.
Type
Boolean
Default
true
Distributed tracing
Enable or disable the adding of distributed tracing headers to network requests.
Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions.
Available for Android agent version 5.4.0 or higher.
Type
Boolean
Default
true
Enable or disable default interactions. Trace instrumentation still occurs, but no traces are harvested. This will enable or disable default interactions only while custom interactions remain enabled.
Type
Boolean
Default
true
Networking settings
Enable or disable reporting successful HTTP requests to the MobileRequest event type.
Available for Android agent version 5.14.0 or higher.
Type
Boolean
Default
true
Enabled by default as of agent version 5.15.2
Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.
Available for Android agent version 5.11.0 or higher.
Type
Boolean
Default
true
Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events.
Type
Boolean
Default
true
Logging settings
Enable or disable agent logging.
Type
Boolean
Default
true
Specifies the log level. Options include:
ERROR (least verbose)
WARNING
INFO (default)
VERBOSE
DEBUG
AUDIT (most verbose)
Type
String
Default
AgentLog.INFO
To increase your logging level in the app, add .withLogLevel to your NewRelic.withApplicationToken() method call. For example:
NewRelic.withApplicationToken("YOUR_APP_TOKEN")
.withLogLevel(AgentLog.DEBUG)
.start(this.getApplication());
Data endpoint settings
Specifies the URI authority component of the harvest data upload endpoint.
Type
Boolean
Default
mobile-collector.newrelic.com
To replace data endpoint the agent will use when reporting data harvests, add .usingCollectorAddress() to your NewRelic.withApplicationToken() method call. For example:
This endpoint is also used for handled exception uploads.
Specifies the authority component of the crash data upload URI.
Type
String
Default
mobile-crash.newrelic.com
To replace data endpoint the agent will use when reporting crashes, add .usingCrashCollectorAddress() to your NewRelic.withApplicationToken() method call. For example: