Blankj / Blankj/AndroidUtilCode

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

Open
#1,784 0 comments 0 reactions 1 assignee Claimed by @Blankj View on GitHub
bug
Dominant language
Java
Stars
33.6k
Forks
10.6k
PR merge metrics
No merged PRs in 30d

Description

## 描述 Bug

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

- AndroidUtilCode 的版本:1.31.1
- 出现 Bug 的设备型号:
- 设备的 Android 版本:

## 相关代码
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](https://github.com/Blankj/AndroidUtilCode/assets/20014318/4e867a76-61e9-438b-bf97-270bf315a7c5)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.