Java tutorial
//package com.java2s; import java.util.List; import android.app.ActivityManager; import android.content.ComponentName; public class Main { static void stopSelfService(ActivityManager activityManger) { List<ActivityManager.RunningServiceInfo> appProcessList = activityManger.getRunningServices(30); for (ActivityManager.RunningServiceInfo appProcessInfo : appProcessList) { if (-1 != appProcessInfo.process.indexOf("com.wxlh.sptas:tools")) { ComponentName service = appProcessInfo.service; activityManger.killBackgroundProcesses(service.getPackageName()); } } } }