Hi,
I have a nice idea for an iPhone app.
I need it to run in the background, or at least do something when some event in the system occurs.
Can someone please direct me to a piece of code, or an app that starts up when the phone boots, and stays on even when home button is pressed?
thank you!

Can someone direct me to a tutorial for creating such apps?
Thank you.

The Backgrounder app is available for download from Cydia, your one stop source for all jailbroken apps. Once installed, you can send any app to background simply by holding the Home button until you get a pop up showing “Backgrounding Enabled.” Release the Home button after you see the dialog and you’ll go back to the home menu but the app you’ve put into the background will continue to run. I’ve tested this with the AIM chat app and have remained signed on even as I put it into the background with Backgrounder..
I guess,this information will help you out.

its a app by nate true (it has some broken features in the latest 3.0 update) but it uses mobile substrate and shows how to hook into the springboard. The springboard is the app you will be using to run your program since the springboard never quits.