Blankj / AndroidUtilCode

:fire: Android developers should collect the following utils(updating).
https://blankj.com/2016/07/31/android-utils-code/
Apache License 2.0
33.32k stars 10.69k forks source link

UtilsActivityLifecycleImpl.isAppForeground()是否后台的判断初始值是不是错了 #1784

Open Bter opened 1 year ago

Bter commented 1 year ago

描述 Bug

APP处于后台,点击通知栏启动Activity前判断了一下是否处于前台,UtilsActivityLifecycleImpl.isAppForeground()返回true;但实际是处于后台的。

相关代码

public void onReceive(Context context,final Intent intent) { String action = intent.getAction(); LogUtil.i(">>>>>>>>>>>>>" + action); if(ACTION_OPEN_SCREEN.equalsIgnoreCase(action)){ if(!AppUtils.isAppForeground()){ //APP在后台 } } }

截图

image