List of usage examples for android.app ActivityManager.RunningServiceInfo getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:Main.java
/** * check whether specific service is running. * @param context// w w w .j a v a2s . c o m * @param serviceClassFullName the full class name of service * @return true if service is running */ public static boolean isServiceRunning(Context context, String serviceClassFullName) { ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.RunningServiceInfo> runningServices = manager.getRunningServices(1024); for (ActivityManager.RunningServiceInfo info : runningServices) { if (info.getClass().getName().equals(serviceClassFullName)) return true; } return false; }