Android Jetpack架构之ProcessLifeCycleOwner
一、ProcessLifeCycleOwner是什么?
用于监听App程序的生命周期。
二、示例
ApplicationObserver类:
class ApplicationObserver: LifecycleObserver { }
DemoApplication类:
class DemoApplication : Application() { override fun onCreate() { super.onCreate() ProcessLifecycleOwner.get().lifecycle.addObserver(ApplicationObserver()) } }