获取某service是否在运行
/**
* 判断sevice是否运行着
*
* @param serviceName
* @return
*/
public boolean isServiceRunning(String serviceName) {
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
List<RunningServiceInfo> infos = manager.getRunningServices(30);
for (RunningServiceInfo info : infos) {
if (info.service.getClassName().equals(serviceName)) {
return true;
}
}
return false;
}
tao_zi7890的专栏
补充:移动开发 , Android ,