Xamarin for iOS

Documentation - Pulse for Xamarin.iOS

Setup instructions

1. Install the Raygun4Net provider

In Xamarin Studio, right click the 'Packages' folder and click 'Add Packages...'. Search for 'Raygun4Net' in the Official NuGet Gallery. Select the 'Mindscape.Raygun4Net' package and hit 'Add Package' in the bottom right hand corner.

2. Enable Pulse in your app

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

static void Main(string[] args)
{
  RaygunClient.Initialize("YOUR_APP_API_KEY").AttachPulse();
  UIApplication.Main(args, null, "AppDelegate");

  // 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. The old API enables crash reporting via the static RaygunClient.Attach method which takes your Raygun app API key. This new API has a static RaygunClient.Initialize method, and subsequent AttachPulse and AttachCrashReporting functions that have their own options and can be chained together.

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

3. Provide a user identifier

By default, each user will be identified with a unique guid. If possible, we highly recommend providing your own unique identifiers for your users which can be done as follows. The string you pass into the constructor can be any unique user id you want - email address is just a recommended example. Providing the name is optional.

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

Done

Pulse messages will be sent to Raygun as soon as the app starts up. So once you've set up Pulse in your app, run it up and go to your Pulse dashboard to see the data it collects. Of course Pulse 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 Pulse 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.