Raygun for Xamarin

Today we are pleased to announce that we’ve extended the range of Raygun.io to target Xamarin projects for Android and iOS developers. This is an extension of the existing Raygun4Net provider and is very simple to use. Once you integrate the Raygun4Net provider into your application and deploy it to the store, your Raygun.io dashboard will collect lots of information to help you debug any exceptions that occur. This information includes the stack trace, OS version, phone model, device orientation and much more.

How to use it

Sign into your account at Raygun.io. If you don’t have an account yet, sign up now for a free 30 day trial. Create a new application, give it a name and change your notification settings if desired.

Create Application

After clicking the Create Application button, you’ll come to a page prompting you to select a framework. Select either Xamarin.iOS or Xamarin.Android to see the instructions of how to setup the Raygun4Net provider in your application. On this page, you’ll also see your application API key – you’ll be needing this soon.

Integrate Raygun

Following the instructions, you’ll see the next thing to do is install the Raygun4Net provider into your application. This can be done by searching for “Raygun4Net” in either NuGet or the Xamarin Component Store. For NuGet, right click the project in Visual Studio and select “Manage NuGet Packages”. For the Xamarin Component, double click the Components folder in Xamarin Studio, or right click the Components folder in Visual Studio and click “Get More Components”.

Once installed, you simply need to use the static RaygunClient.Attach method to get the provider to send all unhandled exceptions to your Raygun.io dashboard. When calling this method, pass in your application API key mentioned above. For Android applications, the best place to call this is in the main/entry Activity of the application. For iOS apps, you can make this call in the Main entry point of the application. The RaygunClient is in the Mindscape.Raygun4Net namespace.

RaygunClient.Attach("YOUR_APP_API_KEY");

And that’s all you need to do to get started. After setting this up, we recommend raising an exception in your application to check that things are wired up correctly. If all is well, the instruction page mentioned above will be replaced with the error dashboard displaying the exception. Since you are probably building both an Android and iOS application, repeat these steps to integrate Raygun4Net into your other project.

Support for no internet

When customers are using your application on the move, there are bound to be times when their device is not connected to the internet. If an exception occurs in your application when there isn’t an internet connection, rather than giving up, the Raygun4Net provider will temporarily store the exception message on the device and then report it to Raygun.io whenever it gets another chance. This way, you won’t miss out on any of those important error messages.

If you haven’t got a Raygun account yet, sign up for the free trial now and get ready to have the most bug free mobile applications on the market. If you have any questions, feature requests or feedback, we’d love to hear from you.

Happy error blasting.