private Boolean isServiceRunning(String serviceName) { ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); for (RunningServiceInfo runningServiceInfo : activityManager.getRunningServices(Integer.MAX_VALUE)) { if (serviceName.equals(runningServiceInfo.service.getClassName())) { return true; } } return false; }
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/10443.html