Android Jetpack架构之ProcessLifeCycleOwner
作者:互联网
一、ProcessLifeCycleOwner是什么?
用于监听App程序的生命周期。
二、示例
ApplicationObserver类:
class ApplicationObserver: LifecycleObserver { }
DemoApplication类:
class DemoApplication : Application() { override fun onCreate() { super.onCreate() ProcessLifecycleOwner.get().lifecycle.addObserver(ApplicationObserver()) } }
标签:ProcessLifeCycleOwner,示例,Jetpack,DemoApplication,ApplicationObserver,Android,onC 来源: https://www.cnblogs.com/naray/p/15200113.html