Tag: Color size + + Run list ati ISS tostring running
How to tell if a service is running:
/*** How to determine if a service is running * *@paramMcontext *@paramServiceName is the class name of the package name + service *@returntrue to indicate that the service is not running, false*/ Public Static Booleanisservicework (Context mcontext, String serviceName) {BooleanIswork =false; Activitymanager Myam=(Activitymanager) mcontext. Getsystemservice (Context.activity_service); List<RunningServiceInfo> myList = myam.getrunningservices (40); if(Mylist.size () <= 0) { return false; } for(inti = 0; I < mylist.size (); i++) {String mname=Mylist.get (i). Service.getclassname (). toString (); if(Mname.equals (serviceName)) {iswork=true; Break; } } returniswork; }
A possible usage scenario is to force a specified service to stop.
Questions:
1. In the above instruction logic, there is a suspicious parameter: 40. How does this parameter work?
2. Leave a future ...
How Android determines whether the specified service is running "service"