Hi,
In an Android app, I am implementing a custom caught exception handler to add specific behavior when an uncaught exception is encountered instead of allowing the app to crash. However, I still need to report crashes prevnted by the exception handler in Dynatrace for app’s metrics. The app currently uses com.dynatrace.tools.android:gradle-plugin:8.273.1.1003 for action and event monitoring.
Currently, when I add the custom exception handler, the app crashes no longer show in Dynatrace Managed → Applications → AppName → Crash Analysis.
I have looked in the Dynatrace APIs, but have not found a way to still report crashes with the custom exception handler, only to report errors. Is there a way to add code to manually report a crash or have a caught exception still show in the crash statistics? Thank you!
Example Code
class UniversalExceptionHandler @Inject constructor(...) : Thread.UncaughtExceptionHandler {
override fun uncaughtException(thread: Thread, exception: Throwable) {
// custom code for handling uncaught exceptions instead of crashing
}
}
class MyAndroidApplication : Application(), HasAndroidInjector {
override fun onCreate() {
super.onCreate()<br> // set custom exception handler
Thread.setDefaultUncaughtExceptionHandler(universalExceptionHandler)
}