git.iko.soy/opencode-android
on 66d239c help sign in
27 lines 846 B history raw
1package soy.iko.opencode
3import android.app.Application
4import soy.iko.opencode.data.repo.CrashLogger
5import soy.iko.opencode.di.AppContainer
7class OpencodeApp : Application() {
8 lateinit var container: AppContainer
9 private set
11 override fun onCreate() {
12 super.onCreate()
13 CrashLogger.get(this).install()
14 container = AppContainer(this)
15 // onTerminate() is only called in emulated process environments, not on real
16 // devices. Register a JVM shutdown hook so cleanup (network callback unregister,
17 // scope cancellation, connection close) runs when the process is actually killed.
18 Runtime.getRuntime().addShutdownHook(Thread {
19 container.shutdown()
20 })
21 }
23 override fun onTerminate() {
24 super.onTerminate()
25 container.shutdown()
26 }