Blankj / Blankj/AndroidUtilCode

registerAppStatusChangedListener 熄屏回调多次

Open
#1,480 1 comment 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

registerAppStatusChangedListener监听小米10 pro android11的设备出现如图,先回调onBackground,突然又各自回调了一次onForeground和onBackground。

- AndroidUtilCode 的版本:1.30.5
- 出现 Bug 的设备型号:MI 10 Pro
- 设备的 Android 版本:api30

## 相关代码


AppUtils.registerAppStatusChangedListener(new Utils.OnAppStatusChangedListener() {
@Override
public void onForeground(Activity activity) {
LogUtils.i("前后台调试 切换到前台" + activity.getClass().getSimpleName());
NewPayApplication.ifForeground = true;

}

@Override
public void onBackground(Activity activity) {
LogUtils.i("前后台调试 切换到后台" + activity.getClass().getSimpleName());

}
});

## 截图
![image](https://user-images.githubusercontent.com/48718966/114656614-fb908980-9d20-11eb-84b4-34739a4d74b2.png)
![image](https://user-images.githubusercontent.com/48718966/114656639-064b1e80-9d21-11eb-8e3e-33dbfe883bcc.png)

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.