package com.haussteuerung;

import android.util.Log;

import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;

public class AppLifecycleTracker implements LifecycleObserver {
    private static boolean isAppInForeground = false;

    @OnLifecycleEvent(Lifecycle.Event.ON_START)
    public void onEnterForeground() {
        isAppInForeground = true;
        Log.d("AppLifecycle", "App ist im Vordergrund");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
    public void onEnterBackground() {
        isAppInForeground = false;
        Log.d("AppLifecycle", "App ist im Hintergrund");
    }

    public static boolean isAppInForeground() {
        return isAppInForeground;
    }
}
