以编程方式清除所有最近的任务 [英] Clear all recent tasks Programmatically

查看:142
本文介绍了以编程方式清除所有最近的任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过程序删除所有最近的任务.在发布问题之前,我先用谷歌搜索过,但根本没有运气.

I am trying to remove all recent tasks through a program. Before posting a question, I googled it, but no luck at all.

我尝试使用ActivityManager.killBackgroundProcess(pckagename),但是它也没有从最近的任务列表中删除该任务.

I tried to use ActivityManager.killBackgroundProcess(pckagename), but it also does not remove the task from a recent task list.

我也尝试了链接 Android,如何清除大多数手机中可以通过主页"按钮获得的近期任务列表?反思是一种可能的方式吗?

我总是遇到以下异常

java.lang.SecurityException:权限被拒绝: 从pid = 23297中移除removeTask(),uid = 10051需要 android.permission.REMOVE_TASKS

java.lang.SecurityException: Permission Denial: removeTask() from pid=23297, uid=10051 requires android.permission.REMOVE_TASKS

即使我已经在清单中指定了android.permission.REMOVE_TASKS权限.

Even if I already specified the android.permission.REMOVE_TASKS permission in the manifest.

我们如何以编程方式清除近期任务列表,以便用户在近期任务列表中看不到任何近期任务?

How can we clear the list of recent tasks programmatically, so that the user can see no recent tasks in a recent task list?

推荐答案

REMOVE_TASKSsignature级权限.它只能由设备固件开发人员(例如设备制造商或ROM mod作者)编写的应用程序持有.

REMOVE_TASKS is a signature-level permission. It can only be held by apps written by the developers of the device firmware, such as a device manufacturer or ROM mod author.

这篇关于以编程方式清除所有最近的任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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