Logo Icon Logo
A Crowd-sourced Cookbook on Writing Great Android® Apps
GitHub logo Twitter logo OReilly Book Cover Art
Getting Bug Reports from Users Automatically with BugSenseBack to Android Cookbook Home | Up to Chapter: Testing

Author: Ian Darwin ('idarwin')
In Published Edition? Yes
FormatLanguage: WikiFormat

Getting Bug Reports from Users Automatically with BugSense


Users don't necessarily inform you every time your app crashes,and when they do, often important details are omitted. You'd like a service that catches every exception and reports it in detail.


Sign up with BugSense free or premium, add a jar file and one call to your app. Sit back and await notifications, or view the web dashboard for lists of errors and detail pages.


There is no magic to the BugSense service, and there's nothing you couldn't do yourself. But it's already done for you, so just use it! The basic steps are:

  1. Create an account with BugSense free or premium, at bugsense.com
  2. Register your app, and retrieve its unique key from the web site
  3. Download and add a jar file to your project
  4. Add one call (using the app's uniqe keys) into your main Activity's onCreate method
  5. Distribute your app to users
  6. Sit back and await notifications, or view the web dashboard for lists of errors and detail pages.


Create Account and Get Application Key

This is done via the BugSense web site.

Add Jar to Project

The Jar file you need is bugsense-trace.jar, which you can download from here or from bugsense.com.

You probably know how to add Jars to your project, if not, see Referencing libraries to implement external functionality.

Since this mechanism reports errors via the internet, it should go without saying (but let me say it anyway): you need internet permission! Add this to your AndroidManifest:

<uses-permission android:name="android.permission.INTERNET" />

Invoke BugSense at App Start

You really only need to make one call, in your onCreate method, typically after invoking setContentView().

Here, for example, is the first part of the onCreate() method of my JPSTrack program:

private static final String OUR_BUGSENSE_API_KEY = "";

public void onCreate(Bundle savedInstanceState) {
    // set up BugSense bug tracking
    BugSenseHandler.setup(this, OUR_BUGSENSE_API_KEY);

Of course BugSenseHandler needs to be imported, but Eclipse will do that for you (if not, go to the Source Menu then to Organize Imports).

Distribute App and Watch for Crash Reports

This also can only be done using the web reporting page, which is accessible after you login.

See Also

Start at the BugSense web site. For more information on what it can do, see the Features Page.

There is also a Google Code Project named ACRA which provides similar data-capturing functionality but is not so strong on the reporting side, at least at present.