git.iko.soy/parseable-android
on c9b724f help sign in
29 lines 881 B history raw
1package com.parseable.android
3import android.app.Application
4import dagger.hilt.android.HiltAndroidApp
5import timber.log.Timber
7@HiltAndroidApp
8class ParseableApp : Application() {
10 override fun onCreate() {
11 super.onCreate()
13 if (BuildConfig.DEBUG) {
14 Timber.plant(Timber.DebugTree())
15 }
17 installUncaughtExceptionHandler()
18 }
20 private fun installUncaughtExceptionHandler() {
21 val defaultHandler = Thread.getDefaultUncaughtExceptionHandler()
22 Thread.setDefaultUncaughtExceptionHandler { thread, throwable ->
23 Timber.e(throwable, "Uncaught exception on thread ${thread.name}")
24 // Delegate to the default handler so the system can still terminate
25 // the process for truly fatal errors (e.g. OOM).
26 defaultHandler?.uncaughtException(thread, throwable)
27 }
28 }