Use the methods below to change default mobile monitoring settings. All settings, including the call to invoke the agent, are called in the onCreate
method of the MainActivity
class.
To change settings, you have two options (if the setting supports it):
- Change the setting on its own line for each specific condition. For example:
NewRelic.disableFeature(FeatureFlag.DefaultInteractions);NewRelic.enableFeature(FeatureFlag.CrashReporting);NewRelic.withApplicationToken(NEW_RELIC_TOKEN).start(this.getApplication());
OR
- Change the setting as part of the agent start call using the
.with
method. For example:
NewRelic.withApplicationToken(NEW_RELIC_TOKEN) .withDefaultInteractions(false) .withCrashReportingEnabled(true) .start(this.getApplication());
Analytics settings
Description | Example |
---|---|
Enable or disable collection of event data. These events can be queried with NRQL and used in the Crash analysis page. Default value is |
|
Enable or disable the reporting of event data. Event collection will still occur, but the events will not be sent to our collector. You might decide to use this instead of Default value is |
|
App launch time settings
Description | Example |
---|---|
Enable or disable reporting app launch time (cold and hot time) to the metrics:
|
|
Application settings
Description | Example |
---|---|
Set the application's version as a string. Defaults to version number set in |
|
Set the build's version as a string. Defaults to build ID set in |
|
Background reporting
Description | Example |
---|---|
Enable or disable background reporting when application goes to the background state. | Background reporting is disabled by default. To enable it, add the following feature flag:
|
Crash and error reporting settings
Description | Example |
---|---|
Enables or disables deferred crash reporting. Default value is |
|
Enable or disable recording handled exceptions events, which appear on the Handled exception page. Default value is |
|
Enable or disable recording of native runtime crashes, exceptions and Application Not Responding (ANR) conditions, which appear on the Crash Analysis page. Default value is |
|
Distributed tracing
Description | Example |
---|---|
Enable or disable the adding of distributed tracing headers to network requests. Default value is Refer to How New Relic distributed tracing works for more information on distributed tracing in mobile apps. |
|
Event persistence
Description | Example |
---|---|
Enable or disable event persistence. | Event persistence is disabled by default. To enable it, add the following feature flag:
|
FedRamp settings
Description | Example |
---|---|
Enable or disable reporting data using different endpoints for US government clients. Default value is |
|
Interaction settings
Description | Example |
---|---|
Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions. Default value is |
|
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. Default value is |
|
Logging settings
Description | Example |
---|---|
Enable or disable agent logging. Default value is |
|
Specifies the log level. Options include:
|
|
Networking settings
Description | Example |
---|---|
Enable or disable reporting successful HTTP requests to the MobileRequest event type. Default value is |
|
Enable or disable reporting network and HTTP request errors to the MobileRequestError event type. Available for Android agent version 5.11.0 or higher. Default value is |
|
Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events. Default value is |
|
Offline storage
Description | Example |
---|---|
Enable or disable offline data storage when no internet connection is available. To configure the amount of offline storage, see Set max offline storage size. | Offline storage is disabled by default. To enable it, add the following feature flag:
|
New Relic's iOS agent provides configuration settings to change the default behavior of the agent. If you make any changes to the default settings, make sure to add the feature flags just after calling the app token. For example:
- Objective-C:
+ [NewRelic startWithApplicationToken:]
- Swift:
NewRelic.start(withApplicationToken:)
Enable or disable feature flags
To configure feature flags, use the following method defined in NewRelic.h:
iOS language | Procedure |
---|---|
Objective-C | In Objective-C, these features are bitmasked, so you can use a Enable a feature flag:
Disable a feature flag:
Here is an example where:
|
Swift | Enable a feature flag:
Disable a feature flag:
Example to disable default interaction tracing:
|
Data endpoint settings
Description | Example |
---|---|
Enable or disable crash reporting, which appears on the Crash analysis page. Specifies the URI authority component of the harvest data upload endpoint. This endpoint is also used for handled exception uploads. To replace data endpoint the agent will use when reporting data harvests, add Default value is |
|
Specifies the authority component of the crash data upload URI. To replace data endpoint the agent will use when reporting crashes, add Default value is |
|
Crash and error reporting feature flag
If you modify any of crash and error reporting settings below, be sure to call the feature flag before the iOS agent start call.
Description | Example |
---|---|
Enable or disable crash reporting, which appears on the Crash analysis page. Specifies the URI authority component of the harvest data upload endpoint. This endpoint is also used for handled exception uploads. To replace data endpoint the agent will use when reporting data harvests, add Default value is |
|
Globally enable or disable recording handled exceptions events, which appear on the Handled exception page. Default value is |
|
Distributed tracing
Description | Example |
---|---|
Enable or disable the adding of distributed tracing headers to network requests. Refer to How New Relic distributed tracing works for more information on distributed tracing in mobile apps. Default value is |
|
Interactions feature flags
If you modify any of crash and error reporting settings below, be sure to call the feature flag just before the New Relic iOS agent start call.
Description | Example |
---|---|
Enable or disable interaction tracing only for default instrumented classes and methods. Custom interactions will be reported. The traces will appear on the Interactions page. Default value is |
|
Globally enable or disable interaction traces, which appear on the Interactions page. Interaction tracing will be disabled after the agent has started. Interactions for any activity or methods executed prior to starting the agent may still appear on the Interactions page. Default value is |
|
CautionBefore enabling this feature, see Enable Swift interaction traces. If proper steps are not taken, enabling this feature may cause instability. Enable or disable interaction tracing for Swift code. The traces appear on the Interactions page. This feature will always be disabled if Default value is |
|
Enable or disable automatic WKWebView instrumentation. Default value is |
|
CautionThis feature is deprecated, enabling this feature flag call may decrease the stability of applications. Avoid using unless instructed by New Relic. Enable or disable automatic gesture instrumentation. Default value is |
|
Networking feature flags
If you modify any of settings below, be sure to call the feature flag before the New Relic iOS agent start call.
Description | Example |
---|---|
CautionThis feature is deprecated, enabling this feature flag call may decrease the stability of applications. Avoid using unless instructed by New Relic. Enable or disable experimental networking instrumentation. This forces all Default value is |
|
Enable or disable networking instrumentation for Default value is |
|
Enable or disable networking instrumentation. This sends the HTTP response data as MobileRequest events. Default value is |
|
Enable or disable HTTP request error event generation of instrumented network calls that result in an error or failure. These events are reported as MobileRequestError events. Default value is |
|
Enable or disable capture of HTTP response bodies for HTTP error traces, and Default value is |
|
Enable or disable instrumentation for async await URL sessions. Default value is |
|
App launch time settings
Description | Example |
---|---|
Enable or disable reporting app start time (cold and hot time) as a metric:
|
|
FedRAMP endpoints settings
Description | Example |
---|---|
Enable or disable using the FedRAMP endpoints. Default value is |
|
Offline storage
Description | Example |
---|---|
Enable or disable offline data storage when no internet connection is available. To configure the amount of offline storage, see Set max offline storage size. | Offline storage is disabled by default. To enable it, add the following feature flag:
|
Background reporting
Description | Example |
---|---|
Enable or disable background reporting when application goes to the background state. | Background reporting is disabled by default. To enable it, add the following feature flag:
Prerequisites in your iOS app project to use background instrumentation:
|
Automatic log collection
Description | Example |
---|---|
Enable or disable the collection of | Log collection is disabled by default. To enable it, add the following feature flag:
For more information, see iOS agent logging. |
The Capacitor agent SDK allows you to configure default settings to change the behavior of the agent.
If you make any changes to the default settings, make sure to add the feature flags just after calling appToken
.
Here's a sample configuration:
import { NewRelicCapacitorPlugin, NREnums, AgentConfiguration } from '@newrelic/newrelic-capacitor-plugin';import { Capacitor } from '@capacitor/core';
var appToken;
if(Capacitor.getPlatform() === 'ios') { appToken = 'IOS_APP_TOKEN';} else { appToken = 'ANDROID_APP_TOKEN';}
let agentConfig : AgentConfiguration = { analyticsEventEnabled: false, crashReportingEnabled: false, interactionTracingEnabled: false, networkRequestEnabled: false, networkErrorRequestEnabled: false, httpResponseBodyCaptureEnabled: false, loggingEnabled: false, logLevel: NREnums.LogLevel.INFO, webViewInstrumentation: false, collectorAddress: "", crashCollectorAddress: "", sendConsoleEvents: false, fedRampEnabled: false, offlineStorageEnabled: false}
NewRelicCapacitorPlugin.start({appKey:appToken, agentConfiguration:agentConfig})
Available configurations
Description | Example |
---|---|
(Android only) Enable or disable collection of event data. |
|
Enable or disable crash reporting. |
|
Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions. |
|
Enable or disable reporting successful HTTP requests to the |
|
Enable or disable reporting network and HTTP request errors to the |
|
Enable or disable capture of HTTP response bodies for HTTP error traces, and |
|
Enable or disable agent logging. |
|
Specifies the log level. Omit this field for the default log level. Options include: |
|
(iOS only) Enable/Disable automatic instrumentation of |
|
Set a specific collector address for sending data. Omit this field for default address. |
|
Set a specific crash collector address for sending crashes. Omit this field for default address. |
|
Enable or disable sending JavaScript console logs to New Relic. |
|
Enable or disable reporting data using different endpoints for US government clients. |
|
Enable or disable offline data storage when no internet connection is available. To configure the amount of offline storage, see Set max offline storage size. | Offline storage is enabled by default. To disable it, add the following feature flag:
|
Enable or disable background reporting when application goes to the background state. | Background reporting is disabled by default. To enable it, add the following feature flag:
To use background instrumentation, you'll need the following in your iOS app project:
|
The Cordova agent SDK allows you to configure default settings to change the behavior of the agent.
If you make any changes to the default settings, make sure to add the feature flags just after calling appToken
.
Here's a sample configuration:
$# Disable Crash Reporting$cordova plugin add https://github.com/newrelic/newrelic-cordova-plugin.git$ --variable IOS_APP_TOKEN="YOUR_IOS_APP_TOKEN"$ --variable ANDROID_APP_TOKEN="YOUR_ANDROID_APP_TOKEN"$ --variable CRASH_REPORTING_ENABLED="false"$ --variable OFFLINE_STORAGE_ENABLED="false"
Available configurations
Description | Example |
---|---|
Enable or disable crash reporting. | bash
|
Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions. | bash
|
Enable or disable reporting successful HTTP requests to the |
|
Enable or disable reporting network and HTTP request errors to the |
|
Enable or disable capture of HTTP response bodies for HTTP error traces, and |
|
Enable or disable agent logging. | bash
|
Specifies the log level. Omit this field for the default log level. Options include: | bash
|
(iOS only) Enable/Disable automatic instrumentation of | bash
|
Set a specific collector address for sending data. Omit this field for default address. | bash
|
Set a specific crash collector address for sending crashes. Omit this field for default address. | bash
|
Enable or disable sending JavaScript console logs to New Relic. |
|
Enable or disable reporting data using different endpoints for US government clients. | bash
|
Enable or disable offline data storage when no internet connection is available. To configure the amount of offline storage, see Set max offline storage size. | Offline storage is enabled by default. To disable it, add the following feature flag: bash
|
Enable or disable background reporting when application goes to the background state. | Background reporting is disabled by default. To enable it, add the following feature flag: bash
To use background instrumentation, you'll need the following in your iOS app project:
|
The .NET MAUI agent SDK allows you to configure default settings to change the behavior of the agent.
If you make any changes to the default settings, make sure to add the feature flags just after calling appToken
.
Here's a sample configuration:
using NewRelic.MAUI.Plugin;...
public static MauiApp CreateMauiApp(){ var builder = MauiApp.CreateBuilder(); builder .UseMauiApp<App>() .ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); });
builder.ConfigureLifecycleEvents(AppLifecycle => { #if ANDROID AppLifecycle.AddAndroid(android => android .OnCreate((activity, savedInstanceState) => StartNewRelic())); #endif #if IOS
AppLifecycle.AddiOS(iOS => iOS.WillFinishLaunching((_,__) => { StartNewRelic(); return false; })); #endif }); return builder.Build();}
private static void StartNewRelic(){ CrossNewRelic.Current.HandleUncaughtException();
// Set optional agent configuration. Options are: // crashReportingEnabled, loggingEnabled, logLevel, collectorAddress, // crashCollectorAddress,analyticsEventEnabled, networkErrorRequestEnabled, // networkRequestEnabled, interactionTracingEnabled, webViewInstrumentation, // fedRampEnabled, offlineStorageEnabled, newEventSystemEnabled, backgroundReportingEnabled // AgentStartConfiguration agentConfig = new AgentStartConfiguration(crashReportingEnabled:false);
if (DeviceInfo.Current.Platform == DevicePlatform.Android) { CrossNewRelic.Current.Start("APP_TOKEN_HERE"); // Start with optional agent configuration // CrossNewRelic.Current.Start("APP_TOKEN_HERE", agentConfig); } else if (DeviceInfo.Current.Platform == DevicePlatform.iOS) { CrossNewRelic.Current.Start("APP_TOKEN_HERE"); // Start with optional agent configuration // CrossNewRelic.Current.Start("APP_TOKEN_HERE", agentConfig); }}
Available configurations
Description | Example |
---|---|
(Android only) Enable or disable collection of event data. |
|
Enable or disable crash reporting. |
|
Enable or disable agent logging. |
|
Enable or disable reporting successful HTTP requests to the |
|
Enable or disable reporting network and HTTP request errors to the |
|
Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions. by default false |
|
Enable/Disable automatic instrumentation of WebViews. |
|
Enable or disable reporting data using different endpoints for US government clients. |
|
Specifies the log level. Omit this field for the default log level. Options include: |
|
Set a specific collector address for sending data. Omit this field for default address. |
|
Set a specific crash collector address for sending crashes. Omit this field for default address. |
|
Enable or disable offline data storage when no internet connection is available. To configure the amount of offline storage, see Set max offline storage size. | Offline storage is enabled by default. To disable it, add the following feature flag:
|
Enable or disable background reporting when application goes to the background state. | Background reporting is disabled by default. To enable it, add the following feature flag:
To use background instrumentation, you'll need the following in your iOS app project:
|
The Flutter agent SDK allows you to configure default settings to change the behavior of the agent.
If you make any changes to the default settings, make sure to add the feature flags just after calling appToken
.
Here's a sample configuration:
if (Platform.isAndroid) { appToken = AppConfig.androidToken;} else if (Platform.isIOS) { appToken = AppConfig.iOSToken;}
Config config = Config( accessToken: appToken, analyticsEventEnabled: false, networkErrorRequestEnabled: false, networkRequestEnabled: false, crashReportingEnabled: false, interactionTracingEnabled: false, httpResponseBodyCaptureEnabled: false, loggingEnabled: false, webViewInstrumentation: false, printStatementAsEventsEnabled: false, httpInstrumentationEnabled: false, offlineStorageEnabled: true);
// NewrelicMobile.instance.start(config, () {// runApp(MyApp());// });
runZonedGuarded(() async { WidgetsFlutterBinding.ensureInitialized(); FlutterError.onError = NewrelicMobile.onError; await NewrelicMobile.instance.startAgent(config); runApp(MyApp());}, (Object error, StackTrace stackTrace) { NewrelicMobile.instance.recordError(error, stackTrace);});
Available configurations
Description | Example |
---|---|
(Android only) Enable or disable collection of event data. |
|
Enable or disable crash reporting. |
|
Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions. |
|
Enable or disable reporting successful HTTP requests to the |
|
Enable or disable reporting network and HTTP request errors to the |
|
Enable or disable capture of HTTP response bodies for HTTP error traces, and |
|
Enable or disable agent logging. |
|
Specifies the log level. Omit this field for the default log level. Options include: |
|
(iOS only) Enable/Disable automatic instrumentation of |
|
Set a specific collector address for sending data. Omit this field for default address. |
|
Set a specific crash collector address for sending crashes. Omit this field for default address. |
|
Enable or disable sending JavaScript console logs to New Relic. |
|
Enable or disable offline data storage when no internet connection is available. To configure the amount of offline storage, see Set max offline storage size. | Offline storage is enabled by default. To disable it, add the following feature flag:
|
Enable or disable the adding of distributed tracing headers to network requests. Default value is For more information on distributed tracing in mobile apps, see browser and mobile trace reporting | Distributed tracing is enabled by default. To disable it, add the following feature flag:
|
Enable or disable background reporting when application goes to the background state. | Background reporting is disabled by default. To enable it, add the following feature flag:
To use background instrumentation, you'll need the following in your iOS app project:
|
The React Native agent SDK allows you to configure default settings to change the behavior of the agent.
If you make any changes to the default settings, make sure to add the feature flags just after calling appToken
.
Here's a sample configuration:
import NewRelic from 'newrelic-react-native-agent';import * as appVersion from './package.json';import {Platform} from 'react-native';
let appToken;
if (Platform.OS === 'ios') { appToken = 'IOS_APP_TOKEN';} else { appToken = 'ANDROID_APP_TOKEN';}
const agentConfiguration = { Config config = Config( analyticsEventEnabled: false, crashReportingEnabled: false, interactionTracingEnabled: false, networkRequestEnabled: false, networkErrorRequestEnabled: false, httpResponseBodyCaptureEnabled: false, loggingEnabled: false, logLevel: NREnums.LogLevel.INFO, webViewInstrumentation: false, collectorAddress: "", crashCollectorAddress: "", sendConsoleEvents: false, fedRampEnabled: false, offlineStorageEnabled:false )};
NewRelic.startAgent(appToken,agentConfiguration);NewRelic.setJSAppVersion(appVersion.version);AppRegistry.registerComponent(appName, () => App);
Available configurations
Description | Example |
---|---|
(Android only) Enable or disable collection of event data. |
|
Enable or disable crash reporting. |
|
Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions. |
|
Enable or disable reporting successful HTTP requests to the |
|
Enable or disable reporting network and HTTP request errors to the |
|
Enable or disable capture of HTTP response bodies for HTTP error traces, and |
|
Enable or disable agent logging. |
|
Specifies the log level. Omit this field for the default log level. Options include: |
|
(iOS only) Enable/Disable automatic instrumentation of |
|
Set a specific collector address for sending data. Omit this field for default address. |
|
Set a specific crash collector address for sending crashes. Omit this field for default address. |
|
Enable or disable sending JavaScript console logs to New Relic. |
|
Enable or disable reporting data using different endpoints for US government clients. |
|
Enable or disable offline data storage when no internet connection is available. To configure the amount of offline storage, see Set max offline storage size. | Offline storage is enabled by default. To disable it, add the following feature flag:
|
Enable or disable background reporting when application goes to the background state. | Background reporting is disabled by default. To enable it, add the following feature flag:
To use background instrumentation, you'll need the following in your iOS app project:
|
New Relic offers default settings for mobile app monitoring in Unity. You can easily adjust these settings within the Unity editor to fit your specific needs.
To configure these settings:
Launch the Unity Editor and open your Unity project.
From the menu bar, select Tools > New Relic > Getting Started > New Relic Configuration.
The left-hand Inspector window displays a list of default settings. Simply check the box next to a setting to enable it, or uncheck the box to disable it.
Click Add component.
The Xamarin agent SDK allows you to configure default settings to change the behavior of the agent.
If you make any changes to the default settings, make sure to add the feature flags just after calling appToken
.
Here's a sample configuration:
public App (){ InitializeComponent();
MainPage = new MainPage(); Application.Current.PageAppearing += OnPageAppearing; Application.Current.PageDisappearing += PageDisappearing;
CrossNewRelicClient.Current.HandleUncaughtException(); CrossNewRelicClient.Current.TrackShellNavigatedEvents();
// Set optional agent configuration. Options are: // crashReportingEnabled, loggingEnabled, logLevel, collectorAddress, // crashCollectorAddress, analyticsEventEnabled, networkErrorRequestEnabled, // networkRequestEnabled, interactionTracingEnabled,webViewInstrumentation, // fedRampEnabled, offlineStorageEnabled AgentStartConfiguration agentConfig = new AgentStartConfiguration(crashReportingEnabled: false, offlineStorageEnabled: false);
if (Device.RuntimePlatform == Device.Android) { //CrossNewRelicClient.Current.Start("APP_TOKEN_HERE"); // Start with optional agent configuration CrossNewRelicClient.Current.Start("APP_TOKEN_HERE", agentConfig); } else if (Device.RuntimePlatform == Device.iOS) { //CrossNewRelicClient.Current.Start("APP_TOKEN_HERE"); // Start with optional agent configuration CrossNewRelicClient.Current.Start("APP_TOKEN_HERE", agentConfig); }}
Available configurations
Description | Example |
---|---|
(Android only) Enable or disable collection of event data. |
|
Enable or disable crash reporting. |
|
Enable or disable agent logging. |
|
Enable or disable reporting successful HTTP requests to the |
|
Enable or disable reporting network and HTTP request errors to the |
|
Specifies the log level. Omit this field for the default log level. Options include: |
|
Set a specific collector address for sending data. Omit this field for default address. |
|
Set a specific crash collector address for sending crashes. Omit this field for default address. |
|
Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions. by default false |
|
Enable/Disable automatic instrumentation of WebViews. |
|
Enable or disable reporting data using different endpoints for US government clients. |
|
Enable or disable offline data storage when no internet connection is available. To configure the amount of offline storage, see Set max offline storage size. | Offline storage is enabled by default. To disable it, add the following feature flag:
|
Enable or disable background reporting when application goes to the background state. | Background reporting is disabled by default. To enable it, add the following feature flag:
To use background instrumentation, you'll need the following in your iOS app project:
|