杀死其他应用程序一个应用程序的服务 [英] kill service of one app in other app

查看:185
本文介绍了杀死其他应用程序一个应用程序的服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个不同的应用程序,这个假设两个应用程序是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.

推荐答案

您应该看看意图过滤器。确保您的应用程序有权限访问的服务与您其它应用。希望这个链接可以帮助你:<一href=\"http://justanapplication.word$p$pss.com/2011/02/16/the-android-intent-based-apis-part-five-services-and-intents/\" rel=\"nofollow\">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/

这篇关于杀死其他应用程序一个应用程序的服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆