×
Namespaces

Variants
Actions

Getting real time crash reports from WP apps using HockeyApp

From Nokia Developer Wiki
Jump to: navigation, search

This article explains how to use HockeyApp SDK to get real time crash reports from your beta/live Windows Phone apps.

WP Metro Icon Bug.png
SignpostIcon XAML 40.png
WP Metro Icon WP8.png
SignpostIcon WP7 70px.png
Article Metadata
Code ExampleTested with
SDK: Windows Phone SDK 8.0/7.1
Devices(s): Nokia Lumia 920
CompatibilityArticle
Created: pooja_1650 (01 Aug 2013)
Last edited: pooja_1650 (08 Aug 2013)

Contents

Introduction

HockeyApp is a tool which provides the detailed real-time crash reporting for your Windows Phone apps. It provides information including the file name, method name, line number and the exception which caused the crash. It is simple to integrate into your app, and can be configured so that the user is prompted to share crash information, or such that crash information is sent silently.

Tip.pngTip: HockeyApp is a PAID tool but the trial version is available.

The HockeyApp support site provides instructions on how to integrate HockeyApp with your Windows Phone app, and includes downloadable example code.

This article provides similar instructions and example code.

What HockeyApp does

When the app crashes, HockeyApp detects the crash and stores all necessary information. The next time we open the app, it shows us a dialog asking whether we would like to send the crash report to the developer or not? If the user agrees to send, the report is sent to the developer, otherwise not.

HockeyApp also provides the feature not to show any such dialog to the user. In that case, the report will be automatically sent to the developer without any user interaction.

Ask user to send report

Sample Code

At the time of writing this article, the associated sample code was not working for me so I created my own sample code which is showcased below. In this sample code, a button with text "crash the app" is created on pressing which the app gets crashed. We can then check the crash report in our HockeyApp account. If you have subscribed for email notifications then you will also get crash report via emails as well.

Sample code UI

Prerequisites

References Required

Following references to the DLLs are required.

  • HockeySDK

This can be added by Project | References | Add Reference..

Getting App ID

After successfully registering at HockeyApp site, we will add our app details there like shown below.

Note.pngNote: While registering app, please note that the Namespace field in the form should have the same value as the namespace of your project.

Registering app
Getting App ID

After registering the app, we will get an App ID which we will save for future use.

Integrating HockeyApp into project

After adding a Reference to the HockeyApp SDK, we need to add following code into our project.

  • In App.xaml.cs file:

In the method App(), we need to write following piece of code at the top like shown below.

public App()
{
HockeyApp.CrashHandler.Instance.Configure(this, HockeyApp_AppID_Here);
// rest of the code here
}
  • In the constructor of the root page of the app, for example, in MainPage() of the file MainPage.xaml.cs
 public MainPage()
{
InitializeComponent();
HockeyApp.CrashHandler.Instance.HandleCrashes();
}

Note.pngNote: If you want your app to send crash report to you directly, without any user interaction, then simply pass true in the above written HandleCrashes() method.

Explicitly crashing the app

We will use below code snippet to crash our app whose report can be generated and checked. We will write this code in a button's click event.

private void btnCrash_Click_1(object sender, RoutedEventArgs e)
{
string[] strArr = {"crash","the","app"};
MessageBox.Show(strArr[3]);
}

We are just trying to access an array index which doesn't exists so IndexOutOfBound exception should be raised.

Checking Crash Report

Crash reports can be accessed by signing in into your HockeyApp account. To check the report, we need to go the Crashes tabs >> Apps. Whenever a crash occurs, the counter is incremented and detail is saved.

Summary view

Detailed crash report

As per the above screenshot, we can see all the crashes that occurred in our app along with the time and crash details.

Summary

Attached is the sample code which you can download and check. HockeyApp does provides lots of extra features in other platforms like iOS, Android. Hopefully, for WP, they will be added soon.

References

This page was last modified on 8 August 2013, at 07:49.
189 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×