21

Programming Background Applications

WHAT YOU WILL LEARN IN THIS CHAPTER

  • 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 beginning with version 4 is its support for background applications. Unlike previous versions of the iPhone OS, iOS 4 (and later) 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, which was introduced with iOS 4.

Get Beginning iOS 5 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.