diff --git a/lib_base/src/main/java/com/android/base/app/ApplicationDelegate.kt b/lib_base/src/main/java/com/android/base/app/ApplicationDelegate.kt index 87e3b42..f9610f3 100644 --- a/lib_base/src/main/java/com/android/base/app/ApplicationDelegate.kt +++ b/lib_base/src/main/java/com/android/base/app/ApplicationDelegate.kt @@ -1,5 +1,6 @@ package com.android.base.app +import android.app.Activity import android.app.Application import android.content.Context import android.content.IntentFilter @@ -59,16 +60,16 @@ internal class ApplicationDelegate internal constructor(private val androidCompo fun onLowMemory() {} private fun listenActivityLifecycleCallbacks() { - AppUtils.registerAppStatusChangedListener(this, object : OnAppStatusChangedListener { - override fun onForeground() { - Timber.d("app进入前台") - appStatus.onNext(true) - } - - override fun onBackground() { + AppUtils.registerAppStatusChangedListener(object : OnAppStatusChangedListener { + override fun onBackground(activity: Activity?) { Timber.d("app进入后台") appStatus.onNext(false) } + + override fun onForeground(activity: Activity?) { + Timber.d("app进入前台") + appStatus.onNext(true) + } }) }