Overview

The Airbrake notifier for Android is designed to give you instant notification of exceptions thrown from your Android applications. The notifier hooks into Thread.UncaughtExceptionHandler, which means any uncaught exceptions will trigger a notification to be sent to your Airbrake project.

Features

Installation & Setup

Download the latest .jar file from github and place it in your Android app’s lib/ folder.

Import the AirbrakeNotifier class in your app’s main Activity.

import com.loopj.android.airbrake.AirbrakeNotifier;

In your activity’s onCreate function, register to begin capturing exceptions:

AirbrakeNotifier.register(this, "your-api-key-goes-here");

Configuration

The AirbrakeNotifier.register call requires a context and Airbrake API key to be passed in, and optionally a third argument specifying the environment. The environment defaults to production if not set.

To notify Airbrake of non-fatal exceptions, or exceptions you have explicitly caught in your app, you can call AirbrakeNotifier.notify. This call takes exactly one argument, a Throwable, and can be called from anywhere in your code. For example:

try {
    // Something dangerous
} catch(Exception e) {
    // We don't want this to crash our app, but we would like to be notified
    AirbrakeNotifier.notify(e);
}

Building from Source

To build a .jar file from source, make a clone of the airbrake-android github repository and run:

ant package

This will generate a file named airbrake-android.jar.

Reporting Bugs or Feature Requests

Please report any bugs or feature requests on the github issues page for this project here:

https://github.com/loopj/airbrake-android/issues

License

The Airbrake notifier for Android is released under the Android-friendly Apache License, Version 2.0. Read the full license here:

http://www.apache.org/licenses/LICENSE-2.0

About the Author

I'm James Smith, CTO of heyzap.com. Originally from London, UK I now live in San Francisco.