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

Monitor your .NET MAUI mobile app

Our New Relic .NET MAUI agent monitors your .NET MAUI mobile app and provides deep insights into your app's performance, errors, and user experience. Once you install and configure the .NET MAUI agent, you'll be able to:

  • Capture C# errors: Identify and fix problems quickly.
  • Track network requests: See how your app interacts with the backend.
  • Use distributed tracing: Drill down into handled exceptions and find the root cause.
  • Create custom events and metrics: Understand how your users interact with your app.
Summary view of a .NET MAUI mobile app in New Relic

one.newrelic.com > All capabilities > Mobile > (select your .NET MAUI app) > Summary: View .NET MAUI data, track HTTP requests and errors, and monitor how your app is performing over time.

(Recommended) Guided installation

To install the .NET MAUI agent, follow our guided install, located directly in the UI.

Manual installation

If you need to install the agent manually, follow these steps:

Review the requirements

Before you install our .NET MAUI agent, make sure your app meets these version requirements:

  • .NET version 7.0 or higher
  • For Android-native apps: Android 7 (API 24) or higher
  • For iOS-native apps:
    • iOS 11 or higher
    • Latest release of Xcode

Add the .NET MAUI agent to your project

First, you'll need to add our agent, a NuGet package, to your MAUI project:

  1. Open your .NET MAUI solution, select the project you want to add the agent to, and open its context menu.
  2. Click Add > Add NuGet packages, then select NewRelic.MAUI.Plugin.

Copy your application token from the UI

The application token is used for New Relic to authenticate your .NET MAUI app's data. To view and copy your application token in the New Relic UI:

  1. Go to one.newrelic.com, click Integrations & Agents, then click Mobile.
  2. Select your .NET MAUI app.
  3. Go to Settings > Application and copy the displayed Application token.

You'll add this application token in the next step.

Add our agent configuration file to your .NET MAUI project

In your project, open MauiProgram.cs and add the following code:

using NewRelic.MAUI.Plugin;
public static MauiApp CreateMauiApp()
var builder = MauiApp.CreateBuilder();
.ConfigureFonts(fonts =>
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
builder.ConfigureLifecycleEvents(AppLifecycle => {
AppLifecycle.AddAndroid(android => android
.OnCreate((activity, savedInstanceState) => StartNewRelic()));
#if IOS
AppLifecycle.AddiOS(iOS => iOS.WillFinishLaunching((_,__) => {
return false;
return builder.Build();
private static void StartNewRelic()
// 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)
// Start with optional agent configuration
// CrossNewRelic.Current.Start("<APP-TOKEN-HERE>", agentConfig);
} else if (DeviceInfo.Current.Platform == DevicePlatform.iOS)
// Start with optional agent configuration
// CrossNewRelic.Current.Start("<APP-TOKEN-HERE>", agentConfig);

Make sure you paste your application token(s) into appToken = "<APP-TOKEN-HERE>" in the code above. If you deployed your hybrid app to both iOS and Android platforms, you'll need to add two separate tokens: one for iOS and one for Android.

Screen tracking events

The .NET MAUI mobile plugin allows you to track navigation events within the .NET MAUI Shell. To do so, you only need to call the following in App.xaml.cs:

public App()
MainPage = new AppShell();

It is recommended to call this method along when starting the agent. These events will only be recorded after navigation is complete. You can find this data through the data explorer in MobileBreadcrumb (under the name ShellNavigated) or by a NRQL query:

SELECT * FROM MobileBreadcrumb WHERE name = 'ShellNavigated' SINCE 24 HOURS AGO

The breadcrumb will contain three attributes:

  • Current: The URI of the current page.
  • Source: The type of navigation that occurred.
  • Previous: The URI of the previous page. This won't exist if the previous page was null.

(Android only) Add permissions

If you have an Android-native app, you'll need to add INTERNET and ACCESS_NETWORK_STATE permissions in your Platforms/Android/AndroidManifest.xml file:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

Customize the agent instrumentation

Need to customize your agent instrumentation? Our public mobile SDK API methods let you collect custom data, configure default settings, and more.

The following customizations are available for the .NET MAUI agent.

If you want to...

Use this method

Record breadcrumbs to track app activity that may be helpful for troubleshooting crashes.

Record breadcrumbs

Track a method as an interaction.

Start interactions

Stop interactions

Record custom metrics.

Record custom metrics

Record handled exceptions.

Record handled exceptions

Record custom attributes and events.

There are several ways to report custom attributes and events:

Track custom network requests and failures.

Track HTTP requests

Track failing HTTP requests

Shut down the agent.

Shut down the agent

Enable/disable default mobile monitoring settings.

Enable/disable monitoring features

Run a test crash report.

Test crash reporting

Troubleshoot HTTP errors

Missing HTTP data in the UI?

After installing the .NET MAUI agent, wait at least 5 minutes. If no HTTP data appears on the HTTP errors and HTTP requests UI pages, make sure you used HttpMessageHandler in HttpClient.

Copyright © 2024 New Relic Inc.

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