<Check if app's in foreground or background> I wan...
# stackoverflow
u
Check if app's in foreground or background I want to update user status in firestore to online and offline according to whether the app runs in the background or foreground. I'm using LifecycleObserver for it, but the problem is I have to call it in every single activity for it to work. Is there a way to do this without having to call it in every activity? Observer class: class Observer(private val currentUser: User): LifecycleObserver { @OnLifecycleEvent(Lifecycle.Event.ON_START) fun onEnteredForeground() { if...