Return to Snippet

Revision: 53425
at November 23, 2011 01:58 by rockschtar


Initial Code
private Boolean isServiceRunning(String serviceName) {
		
		 ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
		    for (RunningServiceInfo runningServiceInfo : activityManager.getRunningServices(Integer.MAX_VALUE)) {
		        if (serviceName.equals(runningServiceInfo.service.getClassName())) {
		        	return true;
		        }
		    }
		    return false;
	}

Initial URL

                                

Initial Description
This functions checks if a service is running or not.

Initial Title
Android check if service running

Initial Tags
service, android

Initial Language
Java