List of usage examples for android.app ActivityManager getRunningServices
@Deprecated public List<RunningServiceInfo> getRunningServices(int maxNum) throws SecurityException
From source file:com.shadowmaps.example.GpsTestActivity.java
private boolean isShadowServiceRunning(Class<?> serviceClass) { ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if (serviceClass.getName().equals(service.service.getClassName())) { return true; }/*from w w w . jav a 2 s. co m*/ } return false; }
From source file:nz.Intelx.DroidNetLogin.DroidNetLoginActivity.java
private boolean Service_Running() { String Service = getString(R.string.app_id) + ".NetloginController"; ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if (Service.equals(service.service.getClassName())) { return true; }//from w w w . j ava2s .c om } return false; }
From source file:org.durka.hallmonitor.CoreStateManager.java
/** * Is the service running.//from w ww .j a v a 2s . c o m * * @param ctx * Application context. * @return Is the cover closed. */ public boolean getServiceRunning(@SuppressWarnings("rawtypes") Class svc) { Log.d(LOG_TAG, "Is service running called."); ActivityManager manager = (ActivityManager) mAppContext.getSystemService(Context.ACTIVITY_SERVICE); for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if (svc.getName().equals(service.service.getClassName())) { // the service is running Log.d(LOG_TAG, "The " + svc.getName() + " is running."); return true; } } // the service must not be running Log.d(LOG_TAG, "The " + svc.getName() + " service is NOT running."); return false; }
From source file:com.keithandthegirl.ui.activity.EpisodesFragment.java
private boolean isDownloadInProgress() { ActivityManager manager = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE); for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if ("com.keithandthegirl.services.download.DownloadService".equals(service.service.getClassName())) { return true; }/*from w ww . j a v a2 s . c o m*/ } return false; }
From source file:com.keithandthegirl.ui.activity.EpisodesFragment.java
/** * Determines if the MediaPlayerService is already running. * /*from ww w. jav a2s. co m*/ * @return true if the service is running, false otherwise. */ private boolean MediaPlayerServiceRunning() { //Log.v( TAG, "MediaPlayerServiceRunning : enter" ); ActivityManager manager = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE); for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { //Log.v( TAG, "MediaPlayerServiceRunning : service=" + service.service.getClassName() ); if ("com.keithandthegirl.services.playback.MediaPlayerService".equals(service.service.getClassName())) { //Log.v( TAG, "MediaPlayerServiceRunning : exit, MediaPlayerService is running" ); return true; } } //Log.v( TAG, "MediaPlayerServiceRunning : exit, MediaPlayerService is NOT running" ); return false; }
From source file:org.pixmob.freemobile.netstat.MonitorService.java
private boolean isRunning() { ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) if (MonitorService.class.getName().equals(service.service.getClassName())) return true; return false; }
From source file:com.gm.goldencity.util.Utils.java
private boolean isMyServiceRunning(Context ctx, Class<?> serviceClass) { ActivityManager manager = (ActivityManager) ctx.getSystemService(Context.ACTIVITY_SERVICE); for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if (serviceClass.getName().equals(service.service.getClassName())) { return true; }/*from w w w . j a va 2s.c om*/ } return false; }
From source file:com.juick.android.MainActivity.java
static boolean isXMPPServiceRunning(Context ctx) { ActivityManager manager = (ActivityManager) ctx.getSystemService(ACTIVITY_SERVICE); String className = XMPPService.class.getName(); for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if (className.equals(service.service.getClassName())) { return true; }/*from ww w .j a va 2 s . c o m*/ } return false; }
From source file:com.juick.android.MainActivity.java
public static boolean isJAMServiceRunning(Context ctx) { ActivityManager manager = (ActivityManager) ctx.getSystemService(ACTIVITY_SERVICE); String className = JAMService.class.getName(); List<ActivityManager.RunningServiceInfo> runningServices = manager.getRunningServices(Integer.MAX_VALUE); for (ActivityManager.RunningServiceInfo service : runningServices) { if (className.equals(service.service.getClassName())) { return true; }/*from ww w . j a v a 2 s . co m*/ } return false; }
From source file:org.adblockplus.android.AdblockPlus.java
/** * Checks if ProxyService is running./*w ww. jav a 2 s. c o m*/ * * @return true if service is running */ public boolean isServiceRunning() { ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); // Actually it returns not only running services, so extra check is required for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if (service.service.getClassName().equals(ProxyService.class.getCanonicalName()) && service.pid > 0) return true; } return false; }