• /
  • EnglishEspañol日本語한국어Português
  • Log inStart now

Configure mobile monitoring settings

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 true.

withAnalyticsEvents(false)

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 withAnalyticsEvents if you wanted to disable collection but still be able to see what the agent was collecting.

Default value is true.

FeatureFlag.AnalyticsEvents(true)

App launch time settings

Description

Example

Enable or disable reporting app launch time (cold and hot time) to the metrics:

  • Cold start time refers to an app’s starting from scratch. This means that the app’s process has not been created by the system until then.

  • Hot start time refers to when your app’s process is already running in the background.

    Default value is true.

FeatureFlag.AppStartMetrics(false)

Application settings

Description

Example

Set the application's version as a string. Defaults to version number set in AndroidManifest.xml.

withApplicationVersion("MY APP VERSION")

Set the build's version as a string. Defaults to build ID set in AndroidManifest.xml.

withApplicationBuild("MY BUILD VERSION")

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:

NewRelic.enableFeature(FeatureFlag.BackgroundReporting)

Crash and error reporting settings

Description

Example

Enables or disables deferred crash reporting. Default value is false.

withCrashReportingEnabled(true)

Enable or disable recording handled exceptions events, which appear on the Handled exception page. Default value is true.

FeatureFlag.HandledExceptions(false)

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 true.

FeatureFlag.NativeReporting(false)

Distributed tracing

Description

Example

Enable or disable the adding of distributed tracing headers to network requests.

Default value is true.

Refer to How New Relic distributed tracing works for more information on distributed tracing in mobile apps.

FeatureFlag.DistributedTracing(false)

Event persistence

Description

Example

Enable or disable event persistence.

Event persistence is disabled by default. To enable it, add the following feature flag:

NewRelic.enableFeature(FeatureFlag.EventPersistence)

FedRamp settings

Description

Example

Enable or disable reporting data using different endpoints for US government clients.

Default value is true (as of agent version 6.11.0).

FeatureFlag.FedRampEnabled(false)

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 true.

FeatureFlag.InteractionTracing(false)

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 true.

FeatureFlag.DefaultInteractions(false)

Logging settings

Description

Example

Enable or disable agent logging.

Default value is true.

withLoggingEnabled(false)

Specifies the log level. Options include:

  • ERROR (least verbose)

  • WARN

  • INFO

  • VERBOSE

  • DEBUG

  • AUDIT (most verbose)

    Default value is INFO.

withLogLevel(AgentLog.ERROR)

Networking settings

Description

Example

Enable or disable reporting successful HTTP requests to the MobileRequest event type.

Default value is true (as of agent version 5.15.2).

FeatureFlag.NetworkRequests(false)

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 true.

FeatureFlag.NetworkErrorRequests(false)

Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events.

Default value is true.

FeatureFlag.HttpResponseBodyCaptureEnabled(false)

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:

NewRelic.enableFeature(FeatureFlag.OfflineStorage)

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 | to enable or disable multiple features at the same time.

Enable a feature flag:

+[NewRelic enableFeatures:(NRMAFeatureFlags)flags];

Disable a feature flag:

+[NewRelic disableFeatures:(NRMAFeatureFlags)flags];

Here is an example where:

  • Interaction tracing and experimental networking instrumentation are enabled.
  • NSURLSession instrumentation and crash reporting are disabled.
[NewRelic enableFeatures:NRFeatureFlag_SwiftInteractionTracing | NRFeatureFlag_FedRampEnabled];
[NewRelic disableFeatures:NRFeatureFlag_NSURLSessionInstrumentation | NRFeatureFlag_CrashReporting];
[NewRelic startWithApplicationToken:...];

Swift

Enable a feature flag:

NewRelic.enableFeatures(NRMAFeatureFlags.[NRMAFeatureFlag])

Disable a feature flag:

NewRelic.disableFeatures(NRMAFeatureFlags.[NRMAFeatureFlag])

Example to disable default interaction tracing:

NewRelic.disableFeatures(NRMAFeatureFlags.NRFeatureFlag_DefaultInteractions)

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 andCollectorAddress: to your NewRelic.start(withApplicationToken:) method call.

Default value is mobile-collector.newrelic.com.

NewRelic.start(withApplicationToken:YOUR_APP_TOKEN
andCollectorAddress:"harvest-upload.domain.com"
andCrashCollectorAddress:"crash-upload.domain.com");

Specifies the authority component of the crash data upload URI.

To replace data endpoint the agent will use when reporting crashes, add andCrashCollectorAddress: to your NewRelic.start(withApplicationToken:) method call.

Default value is mobile-crash.newrelic.com.

NewRelic.start(withApplicationToken:YOUR_APP_TOKEN
andCollectorAddress:"harvest-upload.domain.com"
andCrashCollectorAddress:"crash-upload.domain.com");

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 .usingCollectorAddress() to your NewRelic.withApplicationToken() method call.

Default value is true.

NewRelic.disableFeatures(NRMAFeatureFlags.NRFeatureFlag_CrashReporting)

Globally enable or disable recording handled exceptions events, which appear on the Handled exception page.

Default value is true.

NewRelic.disableFeatures(NRMAFeatureFlags.NRFeatureFlag_HandledExceptionEvents)

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 true.

NewRelic.disableFeatures(NRMAFeatureFlags.NRFeatureFlag_DistributedTracing)

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 true.

NewRelic.disableFeatures(NRMAFeatureFlags.NRFeatureFlag_DefaultInteractions)

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 true.

NewRelic.disableFeatures(NRMAFeatureFlags.NRFeatureFlag_InteractionTracing)

Caution

Before 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 NRFeatureFlag_InteractionTracing is disabled.

Default value is false.

NewRelic.enableFeatures(NRMAFeatureFlags.NRFeatureFlag_SwiftInteractionTracing)

Enable or disable automatic WKWebView instrumentation.

Default value is true.

NewRelic.disableFeatures(NRMAFeatureFlags.NRFeatureFlag_WebViewInstrumentation)

Caution

This 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 false.

NewRelic.enableFeatures(NRMAFeatureFlags.NRFeatureFlag_GestureInstrumentation)

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

Caution

This 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 NSURLConnection network requests through the NRMAURProtocol.

Default value is false.

NewRelic.enableFeatures(NRMAFeatureFlags.NRFeatureFlag_ExperimentalNetworkingInstrumentation)

Enable or disable networking instrumentation for NSURLSession. These URL traces are sent to the HTTP Requests page.

Default value is true.

NewRelic.disableFeatures(NRMAFeatureFlags.NRFeatureFlag_NSURLSessionInstrumentation)

Enable or disable networking instrumentation. This sends the HTTP response data as MobileRequest events.

Default value is true (as of agent version 6.0.0).

NewRelic.disableFeatures(NRMAFeatureFlags.NRFeatureFlag_NetworkRequestEvents)

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 true.

NewRelic.disableFeatures(NRMAFeatureFlags.NRFeatureFlag_RequestErrorEvents)

Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events.

Default value is true.

NewRelic.disableFeatures(NRMAFeatureFlags.NRFeatureFlag_HttpResponseBodyCapture)

Enable or disable instrumentation for async await URL sessions.

Default value is false (as of agent version 7.4.5).

NewRelic.enableFeatures(NRMAFeatureFlags.NRFeatureFlag_SwiftAsyncURLSessionSupport)

App launch time settings

Description

Example

Enable or disable reporting app start time (cold and hot time) as a metric:

  • Cold time refers to time between starting app and the first draw.

  • Hot time refers to the time it takes for an app to resume from running in the background to the first draw.

    Default value is true (as of agent version 7.4.0).

NewRelic.enableFeatures(NRMAFeatureFlags.NRFeatureFlag_AppStartMetrics)

FedRAMP endpoints settings

Description

Example

Enable or disable using the FedRAMP endpoints.

Default value is false (as of agent version 7.4.5).

NewRelic.enableFeatures(NRMAFeatureFlags.NRFeatureFlag_FedRampEnabled)

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:

NewRelic.enableFeatures(NRMAFeatureFlags.NRFeatureFlag_OfflineStorage)

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:

NewRelic.enableFeatures([NRMAFeatureFlags.NRFeatureFlag_BackgroundReporting])

Prerequisites in your iOS app project to use background instrumentation:

  • Add the key Permitted background task scheduler identifiers with an array including an item containing your apps bundle Id.

  • Enable Background Fetch and Background Processing in the Background Modes section of the Xcode project capabilities.

    Note: iOS only guarantees that iOS will harvest in the background once per twenty-four hour period.

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.

analyticsEventEnabled: true

Enable or disable crash reporting.

crashReportingEnabled: true

Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions.

interactionTracingEnabled: true

Enable or disable reporting successful HTTP requests to the MobileRequest event type.

networkRequestEnabled: true

Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.

networkErrorRequestEnabled: true

Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events.

httpResponseBodyCaptureEnabled: true

Enable or disable agent logging.

loggingEnabled: true

Specifies the log level. Omit this field for the default log level.

Options include: ERROR (least verbose), WARNING, INFO, VERBOSE, AUDIT (most verbose).

logLevel: NREnums.LogLevel.INFO

(iOS only) Enable/Disable automatic instrumentation of WebViews.

webViewInstrumentation: true

Set a specific collector address for sending data. Omit this field for default address.

collectorAddress: "crash-upload-delegate.domain.com"

Set a specific crash collector address for sending crashes. Omit this field for default address.

crashCollectorAddress: "crash-upload-delegate.domain.com"

Enable or disable sending JavaScript console logs to New Relic.

sendConsoleEvents: true

Enable or disable reporting data using different endpoints for US government clients.

fedRampEnabled: false

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:

offlineStorageEnabled: false

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:

backgroundReportingEnabled: true

To use background instrumentation, you'll need the following in your iOS app project:

  • In your app's Info.plist file, add the key "Permitted background task scheduler identifiers". This key should be an array containing a single string value, which is your app's bundle identifier.

  • In the Background Modes section of Xcode project capabilities, enable Background Fetch and Background Processing.

    Note: iOS only guarantees that iOS will harvest in the background once per twenty-four hour period.

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:

bash
$
# 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
$
CRASH_REPORTING_ENABLED = "true"

Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions.

bash
$
INTERACTION_TRACING_ENABLED = "true"

Enable or disable reporting successful HTTP requests to the MobileRequest event type.

networkRequestEnabled: true

Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.

networkErrorRequestEnabled: true

Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events.

httpResponseBodyCaptureEnabled: true

Enable or disable agent logging.

bash
$
LOGGING_ENABLED = "true"

Specifies the log level. Omit this field for the default log level.

Options include: ERROR (least verbose), WARNING, INFO, VERBOSE, AUDIT (most verbose).

bash
$
LOG_LEVEL = "INFO"

(iOS only) Enable/Disable automatic instrumentation of WebViews.

bash
$
WEB_VIEW_INSTRUMENTATION = "true"

Set a specific collector address for sending data. Omit this field for default address.

bash
$
COLLECTOR_ADDRESS = "crash-upload-delegate.domain.com"

Set a specific crash collector address for sending crashes. Omit this field for default address.

bash
$
CRASH_COLLECTOR_ADDRESS = "crash-upload-delegate.domain.com"

Enable or disable sending JavaScript console logs to New Relic.

sendConsoleEvents: true

Enable or disable reporting data using different endpoints for US government clients.

bash
$
FEDRAMP_ENABLED = "false"

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
$
OFFLINE_STORAGE_ENABLED = "false"

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
$
BACKGROUND_REPORTING_ENABLED = "true"

To use background instrumentation, you'll need the following in your iOS app project:

  • In your app's Info.plist file, add the key "Permitted background task scheduler identifiers". This key should be an array containing a single string value, which is your app's bundle identifier.

  • In the Background Modes section of Xcode project capabilities, enable Background Fetch and Background Processing.

    Note: iOS only guarantees that iOS will harvest in the background once per twenty-four hour period.

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.

analyticsEventEnabled: true

Enable or disable crash reporting.

crashReportingEnabled: true

Enable or disable agent logging.

loggingEnabled: true

Enable or disable reporting successful HTTP requests to the MobileRequest event type.

networkRequestEnabled: true

Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.

networkErrorRequestEnabled: true

Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions. by default false

interactionTracingEnabled: false

Enable/Disable automatic instrumentation of WebViews.

webViewInstrumentation: false

Enable or disable reporting data using different endpoints for US government clients.

fedRampEnabled: false

Specifies the log level. Omit this field for the default log level.

Options include: ERROR (least verbose), WARNING, INFO, VERBOSE, AUDIT (most verbose).

logLevel: NREnums.LogLevel.INFO

Set a specific collector address for sending data. Omit this field for default address.

collectorAddress: "crash-upload-delegate.domain.com"

Set a specific crash collector address for sending crashes. Omit this field for default address.

crashCollectorAddress: "crash-upload-delegate.domain.com"

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:

offlineStorageEnabled: false

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:

backgroundReportingEnabled: true

To use background instrumentation, you'll need the following in your iOS app project:

  • In your app's Info.plist file, add the key "Permitted background task scheduler identifiers". This key should be an array containing a single string value, which is your app's bundle identifier.

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.

analyticsEventEnabled: true

Enable or disable crash reporting.

crashReportingEnabled: true

Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions.

interactionTracingEnabled: true

Enable or disable reporting successful HTTP requests to the MobileRequest event type.

networkRequestEnabled: true

Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.

networkErrorRequestEnabled: true

Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events.

httpResponseBodyCaptureEnabled: true

Enable or disable agent logging.

loggingEnabled: true

Specifies the log level. Omit this field for the default log level.

Options include: ERROR (least verbose), WARNING, INFO, VERBOSE, AUDIT (most verbose).

logLevel: NREnums.LogLevel.INFO

(iOS only) Enable/Disable automatic instrumentation of WebViews.

webViewInstrumentation: true

Set a specific collector address for sending data. Omit this field for default address.

collectorAddress: "crash-upload-delegate.domain.com"

Set a specific crash collector address for sending crashes. Omit this field for default address.

crashCollectorAddress: "crash-upload-delegate.domain.com"

Enable or disable sending JavaScript console logs to New Relic.

sendConsoleEvents: true

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:

offlineStorageEnabled: false

Enable or disable the adding of distributed tracing headers to network requests.

Default value is true.

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:

distributedTracingEnabled: false

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:

backgroundReportingEnabled: true

To use background instrumentation, you'll need the following in your iOS app project:

  • In your app's Info.plist file, add the key "Permitted background task scheduler identifiers". This key should be an array containing a single string value, which is your app's bundle identifier.

  • In the Background Modes section of Xcode project capabilities, enable Background Fetch and Background Processing.

    Note: iOS only guarantees that iOS will harvest in the background once per twenty-four hour period.

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.

analyticsEventEnabled: true

Enable or disable crash reporting.

crashReportingEnabled: true

Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions.

interactionTracingEnabled: true

Enable or disable reporting successful HTTP requests to the MobileRequest event type.

networkRequestEnabled: true

Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.

networkErrorRequestEnabled: true

Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events.

httpResponseBodyCaptureEnabled: true

Enable or disable agent logging.

loggingEnabled: true

Specifies the log level. Omit this field for the default log level.

Options include: ERROR (least verbose), WARNING, INFO, VERBOSE, AUDIT (most verbose).

logLevel: NREnums.LogLevel.INFO

(iOS only) Enable/Disable automatic instrumentation of WebViews.

webViewInstrumentation: true

Set a specific collector address for sending data. Omit this field for default address.

collectorAddress: "crash-upload-delegate.domain.com"

Set a specific crash collector address for sending crashes. Omit this field for default address.

crashCollectorAddress: "crash-upload-delegate.domain.com"

Enable or disable sending JavaScript console logs to New Relic.

sendConsoleEvents: true

Enable or disable reporting data using different endpoints for US government clients.

fedRampEnabled: false

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:

offlineStorageEnabled: false

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:

backgroundReportingEnabled: true

To use background instrumentation, you'll need the following in your iOS app project:

  • In your app's Info.plist file, add the key "Permitted background task scheduler identifiers". This key should be an array containing a single string value, which is your app's bundle identifier.

  • In the Background Modes section of Xcode project capabilities, enable Background Fetch and Background Processing.

    Note: iOS only guarantees that iOS will harvest in the background once per twenty-four hour period.

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:

  1. Launch the Unity Editor and open your Unity project.

  2. From the menu bar, select Tools > New Relic > Getting Started > New Relic Configuration.

  3. 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.

    Screenshot of the Unity editor to configure settings
  4. Click Add component.

New Relic offers default settings for mobile app monitoring in Unreal Engine. You can easily adjust these settings within the Unreal editor to fit your specific needs.

To configure these settings:

  1. Launch the Unreal Editor and open your Unreal project.

  2. From the menu bar, select Plugins > New Relic > .

    Screenshot of the Unreal editor to configure settings

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.

analyticsEventEnabled: true

Enable or disable crash reporting.

crashReportingEnabled: true

Enable or disable agent logging.

loggingEnabled: true

Enable or disable reporting successful HTTP requests to the MobileRequest event type.

networkRequestEnabled: true

Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.

networkErrorRequestEnabled: true

Specifies the log level. Omit this field for the default log level.

Options include: ERROR (least verbose), WARNING, INFO, VERBOSE, AUDIT (most verbose).

logLevel: NREnums.LogLevel.INFO

Set a specific collector address for sending data. Omit this field for default address.

collectorAddress: "crash-upload-delegate.domain.com"

Set a specific crash collector address for sending crashes. Omit this field for default address.

crashCollectorAddress: "crash-upload-delegate.domain.com"

Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions. by default false

interactionTracingEnabled: false

Enable/Disable automatic instrumentation of WebViews.

webViewInstrumentation: false

Enable or disable reporting data using different endpoints for US government clients.

fedRampEnabled: false

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:

offlineStorageEnabled: false

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:

backgroundReportingEnabled: true

To use background instrumentation, you'll need the following in your iOS app project:

  • Add the key Permitted background task scheduler identifiers with an array including an item containing your apps bundle Id.
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.