How to kill other apps?

回眸只為那壹抹淺笑 提交于 2019-12-13 03:11:27

问题


How can I kill other applications? I can launch other applications using intents but can't find a way to kill them.

This launches the application:

Intent i = new Intent();
    i.setAction(Intent.ACTION_MAIN);
    i.addCategory(Intent.CATEGORY_LAUNCHER);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    i.setComponent(
        new ComponentName("com.bla.bla...", 
            "com.bla.bla.Main"));
    context.startActivity(i);

I've tried to use the activity manager's kill

killBackgroundProcesses(String packageName)

but that does nothing.

I've also tried

 appContext.stopService(intent)

but that did nothing

来源:https://stackoverflow.com/questions/4504091/how-to-kill-other-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!