Android examples for android.app:ActivityManager
Check Service by service class
//package com.java2s; import android.app.ActivityManager; import android.content.Context; public class Main { public static boolean fnCheckService(Context context, Class ServiceClass) { ActivityManager manager = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); for (ActivityManager.RunningServiceInfo service : manager .getRunningServices(Integer.MAX_VALUE)) { if (ServiceClass.getName().equals( service.service.getClassName())) { return true; }//from ww w. java 2 s. c om } return false; } }