Android获取系统运行的服务

public class ServiceRunningUtil {
    public static boolean isRunning(Context context,String className){        
        ActivityManager manager = (ActivityManager) context.getSystemService(Activity.ACTIVITY_SERVICE);
        List<RunningServiceInfo> services = manager.getRunningServices(100);
        for(RunningServiceInfo info : services){
            if(className.equals(info.service.getClassName())){
                return true;
            }
        }
        return false;
    }
}

 

posted on 2014-05-16 22:36  IOTer  阅读(412)  评论(0编辑  收藏  举报

导航