Daniele B
08/17/2020, 8:58 PMclass AppViewModel : ViewModel(), LifecycleObserver {
val myCoreModel = MyCoreViewModel()
@OnLifecycleEvent(Lifecycle.Event.ON_START)
fun onStart() {
myCoreModel.appEnteredForeground()
}
override fun onCleared() {
super.onCleared()
myCoreModel.appWillClose()
}
}
How can I capture, from within the Android’s ViewModel, the event of the app entering the foreground? I tried this way, but my function appEnteredForeground
doesn’t get fired.florent
08/17/2020, 9:43 PM