List of usage examples for android.content Context ACTIVITY_SERVICE
String ACTIVITY_SERVICE
To view the source code for android.content Context ACTIVITY_SERVICE.
Click Source Link
From source file:com.miz.functions.MizLib.java
public static boolean isLocalCopyBeingDownloaded(Context c) { ActivityManager manager = (ActivityManager) c.getSystemService(Context.ACTIVITY_SERVICE); List<RunningServiceInfo> services = manager.getRunningServices(Integer.MAX_VALUE); int count = services.size(); for (int i = 0; i < count; i++) { if (MakeAvailableOffline.class.getName().equals(services.get(i).service.getClassName())) { return true; }//from w w w. java2 s .c o m } return false; }
From source file:com.cognizant.trumobi.PersonaLauncher.java
public boolean isTopActivityIsPersonaLauncher() { boolean isTopActivityIsLauncher = false; ActivityManager mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); String className = mActivityManager.getRunningTasks(1).get(0).topActivity.getClassName(); System.out.println("top activity name " + className); if (className.equals("com.cognizant.trumobi.PersonaLauncher")) { isTopActivityIsLauncher = true;/* ww w . j av a 2s . c o m*/ } return isTopActivityIsLauncher; }
From source file:com.android.mms.ui.MessageUtils.java
public static boolean isHome(Context context) { List<String> homePackageNames = getHomes(context); String packageName = ""; String className = ""; boolean ret = false; ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); List<RunningTaskInfo> rti = activityManager.getRunningTasks(2); if (rti != null && rti.size() > 0) { packageName = rti.get(0).topActivity.getPackageName(); className = rti.get(0).topActivity.getClassName(); }/*from www . j a va 2s. c o m*/ MmsLog.d(TAG, "package0= " + packageName + " class0=" + className); ret = homePackageNames.contains(packageName); if (!ret) { if ("com.mediatek.mms.ui.DialogModeActivity".equals(className)) { ret = true; } } /// M: fix bug ALPS00687923, check RunningAppProcessInfo IMPORTANCE_FOREGROUND @{ if (!ret) { List<RunningAppProcessInfo> appProcesses = activityManager.getRunningAppProcesses(); if (appProcesses == null || appProcesses.size() == 0) { MmsLog.d(TAG, "appProcesses == null || appProcesses.size() == 0"); ret = false; } else { for (RunningAppProcessInfo appProcess : appProcesses) { if (appProcess.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND && appProcess.processName.equals("com.android.launcher")) { MmsLog.d(TAG, "IMPORTANCE_FOREGROUND == com.android.launcher"); ret = true; } } } } /// @} return ret; }