Senior vice president of iPhone software engineering Scott Forstall offered up more details. Apple looked at thousands of apps to determine what services apps would most need to keep running while in the background. “In iPhone OS 4, we’re providing those services as APIs to developers,” Forstall said. That way, iPhone OS can manage those services to best optimize battery life and performance.
Pandora founder Tim Westergren was on hand to demonstrate a version of Pandora that took advantage of these APIs, showing off one of the most sought-after uses for multitasking. Westergren played streaming music from Pandora while switching over to iTunes to buy a song he liked, and the stream kept playing as he shopped.
Other potential uses for background processes were demonstrated or discussed, such as keeping Skype active to receive VoIP calls, or allowing GPS apps like TomTom to continually track your location. Forstall also discussed an alternative to continuous GPS tracking, which can wear down the battery. An app such as Loopt or Foursquare can register to be notified when an iPhone detects that it has switched to a different cell tower. The app can then be activated and the GPS hardware polled for your new location.
Noting privacy concerns, Forstall revealed a system-wide notification that reveals which apps have requested location data. That will prevent any app from using your location data without your knowledge, and should discourage any developer from trying to do so.
In addition to audio, VoIP, and background location, Forstall also discussed some other background services that developers can add to their apps such as push notifications, local notifications, task completion, and fast-app switching. This last feature lets any application freeze its state so that it idles without using any CPU resources. When the app is switched back to the foreground, it continues running as if nothing happened.