Chapter 21. Background Applications


  • How background code execution works in your iPhone applications

  • Monitoring application states

  • How to detect and opt out of background execution

  • How to track location information in the background

  • Creating local notifications

One of the main features of iOS 4 is its support for background applications. Unlike the previous versions of the iPhone OS, iOS 4 does not automatically terminate your application when you press the Home button on your device. Instead, your application is put into a suspended state and all processing is paused. When you tap on the application icon again, the application resumes from its suspended state and continues execution. If your application should continue executing in the background, you need to modify it to inform the OS.

In this chapter, you will examine how background execution works and some of the limitations placed on your applications. In particular, you will learn how to modify the location application covered in Chapter 20 so that it will continue working even after the user has switched it to the background. Last but not least, you will learn about the local notification feature that is new in iOS 4.

Understanding Background Execution on the iPhone

While iOS 4 supports background code execution, there are several things that you need to understand before you write your application:

  • In order to support background code execution, all applications must be compiled against the iPhone ...

Get Beginning iOS 4 Application Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.