views:

147

answers:

1

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);

Any help is appreciated.

+1  A: 

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

CommonsWare
Is there a better way to do this then? should I use the process class?
ngreenwood6
@ngreenwood6: Ordinary Android SDK applications should not be killing processes.
CommonsWare