Chapter 15. Multitasking

WHAT'S IN THIS CHAPTER?

  • How to set up an AVAudioSession for background operation

  • How to modify your Xcode project to enable background audio processing

  • Enabling remote events when the application is running in the background

Multitasking is a major feature of iOS 4. It not only adds the capabilities of newly developed applications, it enhances the operation of existing applications by enabling them to remain idle in the background, rather than terminate. This enhances the user experience, as the application's launch time and previous state are automatically preserved. It does not mean that all applications are running all the time.

In pre-iOS 4, an application would launch, perform its tasks, and then terminate, ultimately left in a nonrunning state. With iOS 4, an additional background state enables an application to be suspended until it is called upon to run again.

Of course, when a multitasking application is in the background, it should consume minimal resources, which are needed by other active applications. Therefore, system resources should always be considered as you develop your applications.

This chapter demonstrates how to write an audio application that will run in background, where it can still be controlled remotely.

MULTITASKING SERVICES

Apple's iOS 4 multitasking features include the following:

  • Fast app switching

  • Push and Local notifications

  • Background audio

  • Location tracking

  • Voice over IP

The fast app switching is provided by default, but the audio, location, ...

Get Professional iPhone® and iPad™ Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.