Android的ActivityManager killBackgroundProcess不工作 [英] Android ActivityManager killBackgroundProcess not working

查看:574
本文介绍了Android的ActivityManager killBackgroundProcess不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的日食。我想杀死我的应用程序的过程。然而,在日食它似乎并不知道暗示的killBackgroundProcess从ActivityManager,它不会让我继续。我读了你必须有权限终止后台进程和已经添加它没有无论是从清单识别的权限。这里是code,我尝试使用:

  ActivityManager activityManager =(ActivityManager)this.getSystemService(ACTIVITY_SERVICE);
activityManager.kil​​lBackgroundProcess(myProcessId);
 

解决方案

请确保您的目标API级别8,因为该方法是在Android 2.2的只加了。

I am using eclipse. I am trying to kill a process in my application. However, in eclipse it does not seem to know the hint for killBackgroundProcess from the ActivityManager and it will not let me proceed. I read that you have to have permissions to kill background processes and already added the permission which it did not recognize either from the manifest. Here is the code that I am trying to use:

ActivityManager activityManager = (ActivityManager)this.getSystemService(ACTIVITY_SERVICE);
activityManager.killBackgroundProcess(myProcessId);

解决方案

Make sure you are targeting API level 8, as that method was only added in Android 2.2.

这篇关于Android的ActivityManager killBackgroundProcess不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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