android-components / mozilla.components.lib.crash / CrashReporter

# CrashReporter

`class CrashReporter` (source)

A generic crash reporter that can report crashes to multiple services.

In the `onCreate()` method of your Application class create a `CrashReporter` instance and call `install()`:

    CrashReporter(
      services = listOf(
        // List the crash reporting services you want to use
      )
    ).install(this)

With this minimal setup the crash reporting library will capture "uncaught exception" crashes and "native code" crashes and forward them to the configured crash reporting services.

### Types

Prompt | `enum class Prompt`
PromptConfiguration | `data class PromptConfiguration` Configuration for the crash reporter prompt.

### Constructors

<init> | `CrashReporter(services: List<CrashReporterService>, shouldPrompt: Prompt = Prompt.NEVER, enabled: Boolean = true, promptConfiguration: PromptConfiguration = PromptConfiguration(), nonFatalCrashIntent: PendingIntent? = null)` A generic crash reporter that can report crashes to multiple services.

### Properties

enabled | `var enabled: Boolean` Enable/Disable crash reporting.

### Functions

install | `fun install(applicationContext: Context): CrashReporter` Install this CrashReporter instance. At this point the component will be setup to collect crash reports.
submitReport | `fun submitReport(crash: Crash): Unit` Submit a crash report to all registered services.