Step 1 - Installation
Make sure NuGet is installed in Visual Studio, then right-click on your project and select "Manage NuGet Packages..." Make sure you're in the "Online" section in the left hand pane. Then, in the top right search box, search for Mindscape.Raygun4Net.Xamarin.Android and install it.
Alternatively, visit here for instructions on installation using the package manager console.
Step 2 - Configure Raygun
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)
.AttachCrashReporting() // Optional, to enable CrashReporting.
// 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
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.
Unique user tracking
Providing user information will allow your Raygun dashboard to display the number of unique users that each error or crash has affected. This is a huge help with prioritising issues to solve that have the largest impact. You can provide whatever user information that will help you identify performance issues, but make sure to abide by any privacy policies that your company follows.
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.
There are a couple of ways to provide user information, the simplest of which is to set the User property of the RaygunClient instance to an identifier of your choosing:
RaygunClient.Current.User = "email@example.com";
If a single identifier string isn't enough, you can set the UserInfo property instead to provide more information:
RaygunClient.Current.UserInfo = new RaygunIdentifierMessage("firstname.lastname@example.org")
IsAnonymous = false,
FullName = "Robbie Robot",
FirstName = "Robbie"
Here are all the available RaygunIdentifierMessage properties:
|The unique identifier from your system for this user. (passed into the constructor)
|A flag indicating whether the user is logged in (or identifiable) or if they are anonymous. An anonymous user can still have a unique identifier.
|The user's email address. If you use email addresses to identify your users, feel free to set the identifier to their email and leave this blank. We will use the identifier as the email address if it looks like one, and if no email address is specified in this field.
|The user's full name.
|The user's first (or preferred) name.
|A device identifier. Could be used to identify users across devices, or machines that are breaking for many users.
The string properties on a User have a maximum length of 255 characters. Users who have fields that exceed this amount will not be processed.
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.
By default, Raygun4Net will attempt to send the package version of your application with each report. If this is unavailable, or if you need to provide your own custom version value, you can do so by setting the ApplicationVersion property on the RaygunClient.
RaygunClient.Current.ApplicationVersion = "184.108.40.206";