package com.example.smart119

import android.app.Activity
import android.app.Application
import android.os.Bundle
import android.util.Log

object GlobalActivityTracker : Application.ActivityLifecycleCallbacks {
    var currentActivity: Activity? = null

    override fun onActivityResumed(activity: Activity) {
        currentActivity = activity
        Log.d("GlobalActivityTracker", "현재 액티비티: ${activity.localClassName}")
    }

    override fun onActivityPaused(activity: Activity) {
        if (currentActivity === activity) {
            currentActivity = null
        }
    }

    override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {}
    override fun onActivityStarted(activity: Activity) {}
    override fun onActivityStopped(activity: Activity) {}
    override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}
    override fun onActivityDestroyed(activity: Activity) {}
}