Add custom logging in your Xamarin app with HockeyApp

Over the next few months, Xamarin Insights will merge with HockeyApp.

HockeyApp allows you to deploy your apps for testing, get user feedback, view crash reports,… Although the platform is constantly evolving, custom logging is still not fully available. If you want to make use of the new features you need to apply for preseason. Today that’s what you need to do to make use of custom logging.

Create an account

Start with creating an account on You need to confirm your email address. After you have access apply for the preseason on I received a confirmation email of my preaseason application after 1 day. In the menu you’ll now see an extra section called “events”. HockeyApp events

Add logging in your code

First you need to add the HockeyApp NuGet package to your Android or iOS project. As logging is still in beta, you need to add the prerelease:

install-package HockeySDK.Xamarin -prerelease

Open up your MainActivity in your Xamarin.Android project and override the OnCreate method:

protected override void OnCreate(Bundle bundle)
    // Register HockeyApp for crash reports
    // You don't need to provide an AutoCrashManagerListener, but it allows you to auto upload the crash reports without asking the user
    HockeyApp.CrashManager.Register(this, "YOUR APP ID from HockeyApp", new AutoCrashManagerListener());
    HockeyApp.UpdateManager.Register(this, "YOUR APP ID from HockeyApp");
    // In HockeySDK.Xamarin 4.1.0-beta2 the line below was needed 
    // HockeyApp.TraceWriter.Initialize();

    // Register the MetricsManager for Logging
    MetricsManager.Register(this, Application, "YOUR APP ID from HockeyApp");
    // Add an event to track
    MetricsManager.TrackEvent("Demo app started");
// ...

Update: First I added a time stamp into my TrackEvent. Simina Pasat was so kind to inform me (cf. comments below) that custom events are meant for tracking aggregates. In order to let the system make aggregates (with a time stamp that would be difficult) and not reach the upper limit of events it’s better not to use the time stamp

YOUR APP ID from HockeyApp can be found on the HockeyApp overview of your application:

HockeyApp App ID

The logging will only appear on the website after some time, so be patient.