Skip to content

Instantly share code, notes, and snippets.

@tpakis
Last active May 1, 2020 20:56
Show Gist options
  • Save tpakis/667419276f360742bd37aa880c9aa3fa to your computer and use it in GitHub Desktop.
Save tpakis/667419276f360742bd37aa880c9aa3fa to your computer and use it in GitHub Desktop.
class CustomCrashHandler(
private val defaultHandler: Thread.UncaughtExceptionHandler? = null,
applicationContext: Context
) : Thread.UncaughtExceptionHandler {
private val chuckerCollector: ChuckerCollector by lazy {
ChuckerCollector(
context = applicationContext,
// Toggles visibility of the push notification
showNotification = true,
// Allows to customize the retention period of collected data
retentionPeriod = RetentionManager.Period.FOREVER
)
}
override fun uncaughtException(t: Thread?, e: Throwable) {
chuckerCollector.onError("error", e)
defaultHandler?.uncaughtException(t, e)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment