Last active
May 1, 2020 20:56
-
-
Save tpakis/667419276f360742bd37aa880c9aa3fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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