CrashHandler

class CrashHandler(context: Context, defaultHandler: Thread.UncaughtExceptionHandler, activityToBeLaunched: Class<*>) : Thread.UncaughtExceptionHandler

Custom Thread.UncaughtExceptionHandler to handle uncaught exceptions in the app.

This handler launches a specified activity when a crash occurs, passing the exception details via an Intent, and then terminates the app.

Parameters

context

The application context used to launch the crash activity.

defaultHandler

The default uncaught exception handler to fallback on.

activityToBeLaunched

The activity class to be launched when a crash occurs.

Constructors

Link copied to clipboard
constructor(context: Context, defaultHandler: Thread.UncaughtExceptionHandler, activityToBeLaunched: Class<*>)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun uncaughtException(thread: Thread, throwable: Throwable)

Handles uncaught exceptions thrown by any thread.