Java tutorial
//package com.java2s; //License from project: Apache License import android.app.ActivityManager; import android.content.Context; import java.util.ArrayList; public class Main { public static boolean isServiceRunning(Context context, String service) { ActivityManager actManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); ArrayList<ActivityManager.RunningServiceInfo> serviceList = (ArrayList<ActivityManager.RunningServiceInfo>) actManager .getRunningServices(50); for (int n = 0; n < serviceList.size(); n++) { if (serviceList.get(n).service.getClassName().toString().equals(service)) { return true; } } return false; } }