-1

I just want to know how to kill a back ground process/app in iphone. Just like in Auto Lock SBSettings where, the "process" toggle is able to list all the back ground process and allows user to kill any of them.

Thanks in advance.


Thanks 'refulgentis', 'Chuck' for your quick responses.

You're true and also I know that the Apple's public API doesn't allow me to do so. In a jail broken phone how could I do this? How "SBSettings" 'processes' toggle is doing the same?

My requirement is to kill and restart my "Phone (MobilePhone.app)" application. In this case how can I proceed further?

Can you please give me some sample piece of code?

prathumca
  • 410
  • 8
  • 25
  • By doing all R&D I found an easy way for this. By default Apple is providing a shell script and you can find it in your IPhone file system @ "/usr/bin/killall". To kill a process (if you know the process name) just call system(@"/usr/bin/killall processname"). For ex, if you wanna kill your "mobilephone" app, just use this command system("usr/bin/killall MobilePhone"). - Regards, Prathap – prathumca Dec 18 '09 at 19:18

2 Answers2

4

You can't, using the public API. Anything you write wouldn't be allowed on the App Store.

For jailbroken apps, just use ps -ax and kill.

refulgentis
  • 2,624
  • 23
  • 37
  • What about things like Memory Info, which are in the App store and do similar tasks? It seems to do memory management directly with the OS, and seems to kill the iPod task. – Erich Dec 16 '09 at 18:14
  • 3
    They don't kill apps. They load data into memory so much that the iPhone starts to quit running apps (such as mail, and safari) to free up memory to accommodate the frontmost app. Then when it quits, it releases all its memory, effectively freeing up all the memory it was occupying. In my opinion this is bad behaviour. – Jasarien Dec 16 '09 at 18:57
  • 1
    Also, note that Apple cleared house of memory management apps a few months ago (Google iStat for more info). I wouldn't rely on this being an acceptable approach. – refulgentis Dec 16 '09 at 19:17
  • Thanks 'refulgentis' your quick responses. You're true and also I know that the Apple's public API doesn't allow me to do so. In a jail broken phone how could I do this? How "SBSettings" 'processes' toggle is doing the same? My requirement is to kill and restart my "Phone (MobilePhone.app)" application. In this case how can I proceed further? Can you please give me some sample piece of code? – prathumca Dec 17 '09 at 16:09
2

Since you aren't allowed to have any background apps running on the iPhone, this turns out to be something of a non-issue.

Chuck
  • 234,037
  • 30
  • 302
  • 389
  • 2
    that's not really true--there are lots of apps running in the background, it's just that you aren't allowed to write more of your own. – David Maymudes Dec 16 '09 at 18:56
  • 2
    That's what chuck was trying to say. You're just being pedantic. – Jasarien Dec 16 '09 at 19:01
  • no, *Chuck* was saying something else--I was trying to point out that it's very reasonable for the OP to wish there were a way to shut down the background tasks that are, in fact, running. – David Maymudes Dec 16 '09 at 20:09