Back to project page AndroidText.
The source code is released under:
Apache License
If you think the Android project AndroidText listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.jiechic.androidtext._1_daemon; import java.util.List; /*w w w . ja va2 s.co m*/ import android.app.ActivityManager; import android.content.Context; /** * Created by jiechic on 14-10-15. */ public class Util { // ????????????? public static boolean isServiceAlive(Context context, Class serviceClassName) { ActivityManager manager = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.RunningServiceInfo> running = manager .getRunningServices(Integer.MAX_VALUE); if (running == null || running.size() == 0) { return false; } for (int i = 0; i < running.size(); i++) { if (running.get(i).service.getClassName().equals(serviceClassName.getName())) { return true; } } return false; } }