Android examples for Android OS:Service
is Service Running
//package com.java2s; import android.app.ActivityManager; import android.content.Context; import java.util.List; public class Main { public static boolean isServiceRunning(Context context, String className) { boolean isRunning = false; ActivityManager manager = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.RunningServiceInfo> serviceList = manager .getRunningServices(40); int size = serviceList.size(); for (int i = 0; i < size; i++) { if (serviceList.get(i).service.getClassName().equals(className)) { isRunning = true;//from w ww .j av a2s .c o m break; } } return isRunning; } }