Introduction
HockeyApp is used get crash reports, events and feedback from the users. Its used for testers and analyzing our Applications. For more details, you can click here.
Let’s start
Prior to starting an Android Application, we need to register HockeyApp dashboard new app.
Step 1
Go to http://hockeyapp.net/. Click New App button and open New Window.
Step 2
In the new Window, there are two options. The first one is to create a new app and the other one is for Uploading Build Items [Apk or Zip ], or creating new item manually. Check the last condition - “Don’t Want to upload a build? Create the app manually instead”.
Step 3
In the new window, select Platform, Release Type, and give Title for Application and Package. Click Save button. Afterwards, the system generates new App ID. This key uses Android app, so copy the App ID value.
Step 4
Open Visual Studio -> New Project -> Templates -> Visual C# -> Android -> Blank App.
Select Blank App. Give the Project Name and Project Location.
Step 5
Go to Solution Explorer-> Project Name-> References, followed by right click to Manage NuGet Packages. Open new Dialog box. This dialog box is required to search HockeySDK, followed by installing HockeySDK.Xamarin Packages.
Step 6
Open Solution Explorer-> Project Name-> Resources-> Layout-> Main.axml. Design the page for the Button Event Handler. Here, I created 3 buttons.
Step 7
Now, we need to initialize HockeyApp in MainActvity.cs and add the new namespace given below.
- using HockeyApp.Android;
- using HockeyApp.Android.Metrics;
Step 8
Now, we need to declare the App ID variables.
- public const string HOCKEYAPP_APPID = "YOUR APP ID";
Step 9
Open Solution Explorer-> Project Name-> MainActivity.cs. Click Open CS code page view, followed by adding namespaces given below.
C# code
- protected override void OnCreate(Bundle bundle) {
- base.OnCreate(bundle);
-
- CrashManager.Register(this, HOCKEYAPP_APPID);
- UpdateManager.Register(this, HOCKEYAPP_APPID);
- MetricsManager.Register(Application, HOCKEYAPP_APPID);
- SetContentView(Resource.Layout.Main);
- FindViewById < Button > (Resource.Id.BtnFeedback).Click += delegate {
-
- FeedbackManager.Register(this, HOCKEYAPP_APPID, null);
-
- FeedbackManager.ShowFeedbackActivity(this);
- };
- FindViewById < Button > (Resource.Id.BtnCrash).Click += delegate {
-
- throw new HockeyAppSampleException("You intentionally caused a crash!");
- };
- FindViewById < Button > (Resource.Id.BtnTrackEvent).Click += delegate {
- MetricsManager.TrackEvent("My custom event.");
- };
- }
- protected override void OnResume() {
- base.OnResume();
-
- Tracking.StartUsage(this);
- }
- protected override void OnPause() {
-
- Tracking.StopUsage(this);
- base.OnPause();
- }
Step 10
Now, implement exceptions Class.
C# code
- public class HockeyAppSampleException: System.Exception {
- public HockeyAppSampleException(string msg): base(msg) {}
- }
Step 11
Press F5 or build and run the Application. Check the HockeyApp Dashboard.
Step 12
Go to HockeyApp dashboard and we will see the exception log, Events, and FeedBack. In this log, we can get particular user information, once the error is fixed. Afterwards, change the status to open/close.
Finally, we have successfully created Android app, using HockeyApp.