Doesn't your final statement "Apps can only do one of the things you list" contradict one of your initial statements "Apps can do anything for up to 10 minutes in the background"? I'm not picking an argument, just trying to understand.
To clarify:
but can ask iOS to do certain restricted things on its behalf while it is asleep, e.g. a chat client listen for new messages, a file app complete a download or a radio app continue to stream audio data to the audio circuitry.
A chat client could listen for new messages for up to 10 minutes, but it must also use Push Notifications to work after 10 minutes. The user experience would be inconsistent if some IMs were delivered as Push Notifications and if others came through when the App was still in the background.
I was really saying that there is no specific API that allows a chat client to listen for new messages.
A file App can complete a download, but only if that takes place within the allocated 10 minutes. There's no specific API for it, just the "task completion" one (which as I pointed out earlier, could be used for anything).
You are correct that both of these things can happen in iOS (for up to 10 minutes), but that there is no way for an IM client to stay connected permanently or for a file to download if it takes 11 minutes.
Background Audio is not just a low level "audio circuitry" layer. When you're using an App that is providing background audio (e.g. Pandora, Spotify, Last.fm), the full App (minus GUI) is running in the background. Most Apps aren't just loading a song file from the disk when they play music. They have to share playback statistics, fetch advertising, check what to actually play next etc.
Here's a summary of the APIs that I wrote a while back (another thread):
There are really 7 "Multitasking" APIs:
- Background Audio
- Background VOIP
- Background Location
- Task Completion
- Push Notifications
- Local Notifications
- Fast App Switching
-Fast App Switching: Any App that is compiled to work for iOS 4.0+ should support this automatically. Put simply, when you press the home button
in an App, iOS will store the state of the App before it is closed. When you open the App up again, that state will be restored, and whatever you
were doing will be restored. For many Apps, this will give the illusion of multitasking (although nothing actually runs in the background)
-Push Notifications: Each iOS device maintains a single connection to Apple's Push Notification (APN) service. App developers can set up a server that
sends notifications to the device that give the illusion of multitasking (e.g. getting messages from Windows Live Messenger when it isn't open)
- Local Notifications: This allows developers to schedule notifications locally on the device (rather than relying on a the connection to a server).
This works well for Apps that know when they will be displaying a notification to the user in advance (such as a Notes app with a reminder function).
- Task Completion: This allows Apps to do anything (that an App can normally do) for up to 10 minutes after an App has been closed.
After 10 minutes, iOS will kill the process. This is really intended to be used for doing things that a user would expect to leave running in the
background, such as finishing off downloads/uploads, but there are no actual restrictions. Some Apps will maintain a connection with a server for as
long as possible using the API.
- Background Audio/Location/VOIP: The uses of these are pretty obvious, but the thing that people might not realise is that Apps using them can
effectively run indefinitely (doing whatever they want to in the background). Playing audio in the background might sound simple, but Apps like
Pandora or Spotify need to do more than just output sound, as such the APIs allow them to do that.
With many of these APIs, the interesting thing to note is that most of the time, nothing is actually running in the background (Apple's preferred method of "Multitasking").