You can get the running prcess info with process id from activitymanager, then kill it by Process.KillProcess(mPid).
Could you have a simple introduction for how to use "Force Stop"? As Mike and you said, android will automatically manager the activity and service lifecyle and don't need task management by users. I often meet a case, playback a music on background service and view a a lot picture on foreground, which maybe will cause low memory, then android will kill the background music. You will not hear the music again, but if you check the music process, you will find the music service restart and service is still alive and still occupy system resource. So for this case, I think service should not be restart. What's your opinion? On Apr 23, 3:49 am, Dianne Hackborn <[email protected]> wrote: > Also you shouldn't be able to kill other processes, at all. I would like to > know how you are doing this so that we can close that hole. :) > > And in cupcake, there is a new "Force Stop" option in manage applications, > which does what is needed to make sure as much as possible that a process is > stopped: remove all of its activity records, stop and destroy all of its > services, remove all of its alarms, remove all of its notifications, kill > all of its processes, etc. > > > > On Wed, Apr 22, 2009 at 9:24 AM, Mike Hearn <[email protected]> wrote: > > > Task manager type apps aren't (in theory) needed or appropriate on > > Android. That's why you're having problems. > > > The system will automatically restart services that crash, because it > > believes some app depends on them. Why would your app know better? If > > some activity is connected to a service, force killing that service > > will just cause the activity to crash or hang. That's bad. > > > The system will also manage the existence of processes and shut them > > down when no longer needed. It knows about everything running on the > > system, and can do a better job than any other program or human. > > > I think your problem is that you installed some program that "leaked" > > a service, ie called start and then never called stop. In which case > > that program is buggy and needs to be fixed - the system can't tell > > the difference between a service that's running and doing something > > useful, and one that is just sitting there being useless. Neither can > > the user! > > -- > Dianne Hackborn > Android framework engineer > [email protected] > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

