Xamarin for Android

Real User Monitoring for mobile

Setup instructions

1. Install the Raygun4Net provider

In Visual Studio or Xamarin Studio, use the NuGet package manager to find 'Raygun4Net'. Select the 'Mindscape.Raygun4Net' package, then install the package.

2. Enable Real User Monitoring in your app

In the main Activity of your application, initialize the RaygunClient and attach the Real User Monitoring feature. Your app API key is displayed when you create a new application in your Raygun account, or when you unlock Real User Monitoring for an existing app, or can be viewed in the "Application settings".

protected override void OnCreate(Bundle bundle)

  // Your code

If you have previously enabled Raygun Crash Reporting in your app, you may notice the code above is using a new RaygunClient API. Previously, crash reporting was set up via the static RaygunClient.Attach method which takes your Raygun app API key. The RaygunClient now has a static Initialize method, and subsequent AttachPulse and AttachCrashReporting functions that have their own options and can be chained together.

The old and new methods are compatible with each other, but we recommend using the new Initialize, AttachPulse and AttachCrashReporting methods so that you only need to pass your Raygun app API key once.

3. Provide a user identifier

By default, the Raygun provider will give a unique guid to each user for distinguishing between them. If possible, we highly recommend providing your own unique identifiers for your users which can be done with the code below. The string you pass into the constructor can be whatever unique user id that works best for you - email address is a recommended example. Providing the first name and full name is optional.

RaygunClient.Current.UserInfo = new RaygunIdentifierMessage(emailAddress) {
  FirstName = firstName,
  FullName = fullName


Real User Monitoring messages will be sent to Raygun as soon as the app starts up. So once you've set up Real User Monitoring in your app, run it up and go to your Real User Monitoring dashboard to see the data it collects. Of course Real User Monitoring is most valuable once your app is out there in the store.

Network calls

You can manually log the timings of network calls using the following Raygun4Net API.

RaygunClient.Current.SendPulseTimingEvent(RaygunPulseEventType.NetworkCall, "GET https://raygun.com", 1234);

The name string can be whatever works best for you - the HTTP method and url is a recommended example. The duration is the milliseconds that you've measured the network call to take.

Details about the network calls that you log can be found in the Performance tab of your Real User Monitoring for mobile dashboard.

Documentation missing?

If we don't have documentation about your desired topic, send us a message and we'll create it for you.