Inside iPhone 4.0's multitasking
When it introduced the iPhone OS 4.0 Thursday, Apple showcased seven “tentpoles” that highlight some of the major additions to the iPhone OS. Based on what took center stage on Thursday, this update to the iPhone operating system is a six-sided tent with a really big pole smack in the middle: multitasking.
This long-awaited feature will finally arrive with iPhone OS 4.0, but it’s a much more subtle and careful implementation than most users might expect. Apple is achieving the appearance of multitasking—the ability to run more than one program at a time—through a combination of app-switching features and background processes managed by the operating system itself. What is not being added to iPhone OS 4.0 is the more traditional concept of apps running, full bore, whether you can see that or not.
"[Multitasking] is really easy to implement in a way that drains battery life. It's easy to do it in a way that reduces the performance of the foreground app and makes the phone feel sluggish," Steve Jobs told reporters on Thursday. "We've figured out how to do it and avoid these things."
When people complain that the iPhone doesn’t do multitasking, that doesn’t necessarily mean they’re desperate for a bunch of apps to run on their iPhone simultaneously. (Sometimes they do; more on that in a minute.) No, a major productivity hurdle on the iPhone is the fact that sometimes a user needs to use several apps to perform a task—for example, switching among Mail, Safari and Notes while researching a memo—and switching rapidly between apps is just not something the iPhone handles well. You have to press the home button, find the next app among your home screens, then launch that new app, navigate to where you want it to be, and then repeat the process to switch back.
So when Apple says it’s added multitasking to iPhone OS 4.0, one of the big things it’s added is actually smarter app switching. When you double-press on the Home button, a window raises up from the bottom of the screen, Dock-like, with a list of all the apps you’ve recently used. When you tap on one of those apps, that app launches—allowing quick switching without going back to the Home screen.
Apple pairs this with a new set of tools for app developers to allow apps to do something other than open and quit (which is all they can do right now). Now apps will be able to be frozen—Apple senior vice president Scott Forstall said they’re kept in “a quiescent state in the background.” The key to this state is that it allows apps to pick up right where you left them. It’s not multitasking, not really, but it will satisfy the needs of people who quickly need to switch between different apps without losing their place.
But switching and restoring only goes so far. Sometimes you really do need an app to do something when it's not in the foreground. And so Apple is providing several other tools to developers so that apps can perform tasks in the background. One of them is familiar: the push-notification system introduced a year ago with iPhone OS 3.0. The rest are new. A background audio service allows apps that provide audio, such as Pandora and MLB At Bat, to keep playing while the user switches to another app. This service integrates with familiar controls already in use by the iPod application, such as double-clicking on the Home button when the phone is locked to bring up pause, next and previous buttons.
Another background task supported is Voice over IP, exemplified in a demo on Thursday featuring Skype. The Skype internet-telephony product currently can only send and receive calls when it’s the frontmost app. But by using the new systems in iPhone OS 4.0, Skype and apps like it will be able to keep their connections alive when the user switches to another app, allowing conversations to continue—and allowing incoming calls to still be received, as well.
Apps that want to know where you are will also get a boost in iPhone OS 4.0. Right now, GPS apps and social-networking apps with place-based features only know where you are when you open them. After this software update, GPS apps will be able to keep the GPS receiver in your device active and track your location even when closed. They’ll even be able to remind you that a turn is coming up!
Social-networking apps won’t have access to the GPS data, due to the massive power requirements of using GPS. Instead, Apple has created a system that will notify social-networking apps when the iPhone has switched between cell phone towers, indicating that the user has changed location.
These location features come with a host of privacy features, giving you control over what apps can know your location and letting you specifically approve and ban apps from using them. You’ll even be able to see which apps have been peering in on your location in the last 24 hours, so nothing will take you by surprise. And a small arrow will appear in the iPhone’s status bar, right next to the battery icon, anytime location tracking is happening in the background.
To go with the now-familiar push notification feature, Apple has added a new Local Notifications system. Unlike push notifications, which require an external server to send an event to the phone, these new notifications are originated on the phone itself. The example Forstall gave is that a TV-guide app could alert you when a favorite show is about to start. This seems to be a way for apps to set alerts in advance, for times when they aren’t running, another common reason developers wanted the iPhone OS to have multitasking capabilities.
Task completion, another new multitasking addition, solves a problem that you’ve probably experienced on your iPhone: not knowing whether it was safe to press the Home button and move to another app, because the app you were using was right in the middle of something. Forstall used the example of a photo-uploader app in the middle of uploading an image to the Web. By using task completion, apps will be able to finish what they’re doing even when the user switches away. (We assume this is a feature that works hand in hand with the concept of going into a “quiescent state in the background”—namely that apps are given a chance to finish what they’re doing before they’re frozen in carbonite.)
The multitasking iPhone
So will these new features solve every issue that developers and users have with iPhone apps running in the background? Chances are good that there will still be edge cases, certain uses of certain apps that won’t be solved by these systems. We’ll know more when the update arrives this summer.
But by introducing these features to iPhone OS 4.0, Apple seems to have addressed the most glaring issues with the inability of third-party apps to run in the background, most notably with issues of app switching, streaming audio, and location awareness.