Android examples for Android OS:Service
is Notify Service Running
//package com.java2s; import java.util.List; import android.app.ActivityManager; import android.app.ActivityManager.RunningServiceInfo; import android.content.Context; public class Main { public static boolean isNotifyServiceRunning(Context context, String serviceName) { ActivityManager activityManager = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); List<RunningServiceInfo> serviceInfo = activityManager .getRunningServices(100); for (RunningServiceInfo info : serviceInfo) { String name = info.service.getClassName(); if (name.equals(serviceName)) { return true; }//from www. j av a2 s . co m } return false; } }