杀死其他应用程序一个应用程序的服务
我有两个不同的应用程序,这个假设两个应用程序是A和B.在一次应用程序有很多的服务,我的任务是要杀死B的使用方法的服务,但A和B不APK,是不同的应用程序。
I have two different apps, this hypothesis two apps are A and B. there are many service at A app,my task is want to kill the service of A using method of B, but A and B are not apk ,are different apps.
i used :
ActivityManager manager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
List<RunningAppProcessInfo> activityes = ((ActivityManager) manager).getRunningAppProcesses();
for (int i = 0; i < activityes.size(); i++){
Log.e("APP: "+i, activityes.get(0).processName);
if (!activityes.get(i).processName.contains("com.qihoo360")){
//android.os.Process.killProcess(activityes.get(1).pid);
Log.i("dfd","xx");
manager.killBackgroundProcesses("com.qihoo360.mobilesafe");
android.os.Process.sendSignal(activityes.get(1).pid, android.os.Process.SIGNAL_KILL);
}
}
但移动设置管理器应用程序没有useful.but,它有一个关闭按钮来关闭它。如果我没有权力杀死另一个应用程序,因为系统的安全性。
but no useful.but at mobile setting manager App ,it have a close button to close it. if i no authority to kill another app because System security.
您应该看看意图过滤器。确保您的应用程序有权限访问的服务与您其它应用。希望这个链接可以帮助你:http://justanapplication.word$p$pss.com/2011/02/16/the-android-intent-based-apis-part-five-services-and-intents/
You should look at intent-filters. Make sure your application has permission to access the service and you other application. Hopefully this link could help you out: http://justanapplication.wordpress.com/2011/02/16/the-android-intent-based-apis-part-five-services-and-intents/