We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
public static boolean isAppForegroundRunning(final Context context) { ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); if (activityManager == null) return false; List<ActivityManager.RunningTaskInfo> tasks = activityManager.getRunningTasks(1); if (!tasks.isEmpty()) { ComponentName topActivity = tasks.get(0).topActivity; if (topActivity.getPackageName().equals(context.getPackageName())) { return true; } } return false; }
AndroidProcesses.getRunningForegroundApps(context);
foreground==true,
The text was updated successfully, but these errors were encountered:
我也向作者提问了,如果这个APP,弹出通知,下载进度等,返回结果就是这个应用在前台,其实该应用在后台。
Sorry, something went wrong.
No branches or pull requests
AndroidProcesses.getRunningForegroundApps(context);
如果一个应用退出到后台,但是正在下载文件的话,
AndroidProcesses.getRunningForegroundApps(context);
中的foreground==true,
而以前使用的代码返回值为false,就是说的你的代码判断不准确
The text was updated successfully, but these errors were encountered: