ExceptionReporter | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Tools & Reference
  - Developer Stories

## Results

Loading...
Summary: Ctors | Methods | Inherited Methods | [Expand All]
public class

# ExceptionReporter

extends Object
implements Thread.UncaughtExceptionHandler

java.lang.Object
↳ | com.google.android.gms.analytics.ExceptionReporter

## Class Overview

Used to catch any uncaught exceptions and report them to Google Analytics. This class will call `dispatchLocalHits()` after calling `send(Map)`.

The exact message reported is determined by the `ExceptionParser` set via the `setExceptionParser(ExceptionParser)` method. See `StandardExceptionParser` for an example of an implementation of `ExceptionParser`.

All exceptions reported via this class will be reported as fatal exceptions.

Usage:

     UncaughtExceptionHandler myHandler = new ExceptionReporter(
       myTracker,                                     // Currently used Tracker.
       GAServiceManager.getInstance(),                // GAServiceManager singleton.
       Thread.getDefaultUncaughtExceptionHandler(),   // Current default uncaught exception handler.
       context);                                      // Context of the application.

     // Make myHandler the new default uncaught exception handler.
     Thread.setDefaultUncaughtExceptionHandler(myHandler);

## Summary

Public Constructors
| ExceptionReporter(Tracker tracker, Thread.UncaughtExceptionHandler originalHandler, Context context)

Public Methods
ExceptionParser | getExceptionParser()
void | setExceptionParser(ExceptionParser exceptionParser)
void | uncaughtException(Thread t, Throwable e)

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
From interface java.lang.Thread.UncaughtExceptionHandler
abstract void | uncaughtException(Thread arg0, Throwable arg1)

## Public Constructors

#### public ExceptionReporter (Tracker tracker, Thread.UncaughtExceptionHandler originalHandler, Context context)

##### Parameters

tracker | an active `Tracker` instance. Should not be null.
originalHandler | the current `DefaultUncaughtExceptionHandler`.
context | the current app context. Should not be null.

## Public Methods

#### public ExceptionParser getExceptionParser ()

#### public void setExceptionParser (ExceptionParser exceptionParser)

#### public void uncaughtException (Thread t, Throwable e)