Public class ServiceList extends Activity {@ Overrideprotected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); TextView TV = new TextView (this );
ActivityManager activityManger = (ActivityManager) getSystemService (ACTIVITY_SERVICE); // obtain the List of Activity managers <ActivityManager. runningServiceInfo> serviceList = activityManger. getRunningServices (30); // obtain the running Servicetv from the window manager. setText (getServicesName (serviceList); setContentView (TV);} private boolean ServiceIsStart (List <ActivityManager. runningServiceInfo> list, String className) {// determines whether a service is started for (int I = 0; I <list. size (); I ++) {if (className. equals (list. get (I ). service. getClassName () return true;} return false;} private String getServicesName (List <ActivityManager. runningServiceInfo> list) {// obtain the name of all services String res = ""; for (int I = 0; I <list. size (); I ++) {res + = list. get (I ). service. getClassName () + "/n";} return res ;}}