public void isRun(){ <span style="white-space:pre"> </span>ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); <span style="white-space:pre"> </span>List<RunningServiceInfo> myList = myAM.getRunningServices(40); <span style="white-space:pre"> </span>for (int i = 0; i < myList.size(); i++) { <span style="white-space:pre"> </span>String name = myList.get(i).service.getClassName().toString(); <span style="white-space:pre"> </span>if (name.equals(myclassName)) { <span style="white-space:pre"> </span>return true; <span style="white-space:pre"> </span>} <span style="white-space:pre"> </span>} return false; }