Raygun4Xamarin.Forms 1.0.0-beta

Raygun provider for Xamarin Forms applications

This is a prerelease version of Raygun4Xamarin.Forms.
There is a newer version of this package available.
See the version list below for details.

Requires NuGet 2.8.3 or higher.

Install-Package Raygun4Xamarin.Forms -Version 1.0.0-beta
dotnet add package Raygun4Xamarin.Forms --version 1.0.0-beta
<PackageReference Include="Raygun4Xamarin.Forms" Version="1.0.0-beta" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Raygun4Xamarin.Forms --version 1.0.0-beta
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Raygun4Xamarin.Forms, 1.0.0-beta"
For F# scripts that support #r syntax, copy this into the source code to reference the package.

Raygun4Xamarin.Forms provider

Installation

The provider targets .NET Standard 2.0 and is available through NuGet packages, found here.

The currently supported platforms are Android and iOS with the following versions or newer:

  • Xamarin.Android 8.0
  • Xamarin.iOS 10.0

Initialisation

The initialisation of Raygun must occur early in the apps initial startup phase. We recommend doing this in the constructor of your Application class. Using the static Init method will also ensure a shared RaygunClient instance is available through the static Current property on the RaygunClient class.

public partial class App : Application
{
  public App()
  {
    InitializeComponent();

    // Initialising the Raygun client 
    RaygunClient.Init("_API_KEY_");

    // Remaining application setup logic
    MainPage = new MainPage();
  }
}

Each platform being targeted requires an additional configuration step using the RaygunPlatform class in the following places.

For Android:

public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
  protected override void OnCreate(Bundle savedInstanceState)
  {
    // MainActivity startup logic
    base.OnCreate(savedInstanceState);
    global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
    LoadApplication(new App());

    // Configure Raygun for the current platform
    RaygunPlatform.Configure(this);
  }
}

For iOS:

public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
  public override bool FinishedLaunching(UIApplication app, NSDictionary options)
  {
    // AppDelegate startup logic
    global::Xamarin.Forms.Forms.Init();
    LoadApplication(new App());

    // Configure Raygun for the current platform
    RaygunPlatform.Configure();

    return base.FinishedLaunching(app, options);
  }
}

Unique User Tracking

Providing user information will allow Raygun to correlate error reports and RUM events with specific users.
Assigning user information is performed by assigning a RaygunUserInfo object to your client instance.

RaygunClient.Current.User = new RaygunUserInfo("_UNIQUE_ID_")
{
  FirstName   = "Ronald",
  FullName    = "Ronald Raygun",
  Email       = "ronald@raygun.com",
  IsAnonymous = false
};

Crash Reporting

Once the client is initialised you can enable it's Crash Reporting functionality.

RaygunClient.Current.EnableCrashReporting();

Once enabled your are able to:

  • Automatically report unhandled exceptions
  • Manually report errors
  • Record breadcrumbs

Before send event handling

RaygunClient.Current.BeforeSendingCrashReportEvent += (sender, e) =>
{
  if (e.Report.Details.Error.ClassName == "NotImplementedException")
  {
   	e.Cancel = true;
  }
};

Manually reporting errors

Exceptions may be manually reported using the client.

try
{
  DoSomethingRisky();
}
catch (Exception exception)
{
  RaygunClient.Current.Send(exception);
}

Recording breadcrumbs

Breadcrumbs can be recorded using the client throughout your application. The current crumbs are then sent with each error report sent.

RaygunClient.Current.RecordBreadcrumb("Entered login screen");

Real User Monitoring

Once the client is initialised you can enable it's Real User Monitoring (RUM) functionality.

RaygunClient.Current.EnableRealUserMonitoring();

Once enabled your are able to:

  • Automatically report user sessions
  • Automatically report view timing events
  • Manually report timing events

Manually report timing events

RUM timing events can be manually reported using the client.

RaygunClient.Current.SendTimingEvent(RaygunRUMEventTimingType.ViewLoaded, "TestView", 123);

Raygun4Xamarin.Forms provider

Installation

The provider targets .NET Standard 2.0 and is available through NuGet packages, found here.

The currently supported platforms are Android and iOS with the following versions or newer:

  • Xamarin.Android 8.0
  • Xamarin.iOS 10.0

Initialisation

The initialisation of Raygun must occur early in the apps initial startup phase. We recommend doing this in the constructor of your Application class. Using the static Init method will also ensure a shared RaygunClient instance is available through the static Current property on the RaygunClient class.

public partial class App : Application
{
  public App()
  {
    InitializeComponent();

    // Initialising the Raygun client 
    RaygunClient.Init("_API_KEY_");

    // Remaining application setup logic
    MainPage = new MainPage();
  }
}

Each platform being targeted requires an additional configuration step using the RaygunPlatform class in the following places.

For Android:

public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
  protected override void OnCreate(Bundle savedInstanceState)
  {
    // MainActivity startup logic
    base.OnCreate(savedInstanceState);
    global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
    LoadApplication(new App());

    // Configure Raygun for the current platform
    RaygunPlatform.Configure(this);
  }
}

For iOS:

public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
  public override bool FinishedLaunching(UIApplication app, NSDictionary options)
  {
    // AppDelegate startup logic
    global::Xamarin.Forms.Forms.Init();
    LoadApplication(new App());

    // Configure Raygun for the current platform
    RaygunPlatform.Configure();

    return base.FinishedLaunching(app, options);
  }
}

Unique User Tracking

Providing user information will allow Raygun to correlate error reports and RUM events with specific users.
Assigning user information is performed by assigning a RaygunUserInfo object to your client instance.

RaygunClient.Current.User = new RaygunUserInfo("_UNIQUE_ID_")
{
  FirstName   = "Ronald",
  FullName    = "Ronald Raygun",
  Email       = "ronald@raygun.com",
  IsAnonymous = false
};

Crash Reporting

Once the client is initialised you can enable it's Crash Reporting functionality.

RaygunClient.Current.EnableCrashReporting();

Once enabled your are able to:

  • Automatically report unhandled exceptions
  • Manually report errors
  • Record breadcrumbs

Before send event handling

RaygunClient.Current.BeforeSendingCrashReportEvent += (sender, e) =>
{
  if (e.Report.Details.Error.ClassName == "NotImplementedException")
  {
   	e.Cancel = true;
  }
};

Manually reporting errors

Exceptions may be manually reported using the client.

try
{
  DoSomethingRisky();
}
catch (Exception exception)
{
  RaygunClient.Current.Send(exception);
}

Recording breadcrumbs

Breadcrumbs can be recorded using the client throughout your application. The current crumbs are then sent with each error report sent.

RaygunClient.Current.RecordBreadcrumb("Entered login screen");

Real User Monitoring

Once the client is initialised you can enable it's Real User Monitoring (RUM) functionality.

RaygunClient.Current.EnableRealUserMonitoring();

Once enabled your are able to:

  • Automatically report user sessions
  • Automatically report view timing events
  • Manually report timing events

Manually report timing events

RUM timing events can be manually reported using the client.

RaygunClient.Current.SendTimingEvent(RaygunRUMEventTimingType.ViewLoaded, "TestView", 123);

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Raygun4Xamarin.Forms:

Package Downloads
Xamariners.Logger.Mobile
Library for logger utilities for xamarine mobile apps.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.7 2,076 9/8/2020
1.0.6 748 8/18/2020
1.0.5 3,305 4/2/2020
1.0.4 1,356 3/13/2020
1.0.3 4,041 10/31/2019
1.0.2 184 10/30/2019
1.0.1 358 10/8/2019
1.0.0 896 6/24/2019
1.0.0-beta 275 6/6/2019
Show less