Java tutorial
//package com.java2s; //License from project: Apache License import android.app.ActivityManager; import android.app.ActivityManager.RunningServiceInfo; import android.content.Context; public class Main { public static boolean isServiceRunning(Context context, Class serviceClass) { ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if (serviceClass.getName().equals(service.service.getClassName())) { return true; } } return false; } }