Android examples for Android OS:Service
check Service Is Alive
//package com.java2s; import android.app.ActivityManager; import android.app.ActivityManager.RunningServiceInfo; import android.content.Context; public class Main { public static boolean checkServiceIsAlive(Context context, String serviceName) { ActivityManager manager = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); for (RunningServiceInfo service : manager .getRunningServices(Integer.MAX_VALUE)) { if (serviceName.equals(service.service.getClassName())) { return true; }//ww w .j a va 2 s . c o m } return false; } }