Java tutorial
//package com.java2s; //License from project: Open Source License import android.app.ActivityManager; import android.content.Context; import java.util.List; public class Main { /** * check whether specific service is running. * @param context * @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; } }