标签:info app ems processes systems turn running imp name
private boolean isForeground() { ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.RunningAppProcessInfo> processes = activityManager.getRunningAppProcesses(); if (processes == null || processes.isEmpty()) { return false; } for (ActivityManager.RunningAppProcessInfo info : processes) { if (info.processName.equals(getPackageName()) && info.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) { return true; } } return false; }
标签:info app ems processes systems turn running imp name
原文地址:https://www.cnblogs.com/xiaodidi/p/11944464.html