iPhone OS4 or “iOS4” as its called, recently introduced Multitasking to the apple device, this has a huge impact on how we use our apple devices. However because of the limitations and descriptions of these two features alot of users may be confused. This post is going to attmpt to be a Cliff notes for multitasking / backgrounding.
-Multitasking is the ability to run tasks while running other tasks (I’ll get to specifically what tasks in a moment)
-Backgrounding is when the phone “freezes” your app and unloads it from memory to be returned when you return to your app
Apple allows you to have multitasking under a few specific circumstances. These circumstances are GPS apps, VOIP apps, and audio apps. The GPS profile will allow you access to GPS information and the network, the VOIP profile will allow you access to the network, and audio apps will allow you access to the network and audio output and input apis. When you exit your app depending on what profile you chose those services will continue to run in your app (AND ONLY THOSE SERVICES) doing anything other that collecting and manipulating the data received or sent from those sources will get your app booted out of memory by the OS.You can however manipulate UIViews but you obviusly wont see the changes untill you reopen the app.
BUT WAIT! what if I want to do something other than voip/GPS/audio?
Well using the VOIP profile to create a new AIM client is a sure way to get your app rejected by apple, however if you want to do other operations in the background there is a solution to that! Regular app services allow you to complete running a task in the background while running other apps. Basically regular app services allow you 10 minutes to do whatever you want (excluding processor intensive tasks like running openGL animations). This feature is great for apps like dropbox which will now let you finish uploading or downloading a file in the background while you perform other tasks.
Backgrounding is now included in every app you create for iOS4 what backgrounding does is essentially freeze your app so that when you come back to it you are right where you left off. If you are three pages deep in an app and need to take a call when you return from your oh so important call you will be exactly where you left off in the app, no extra code required! If you don’t want this functionality you can opt out of it in your apps Info.plist file.
Both of these new features are great additions to the iPhone. Although there are some limitations, those limitations are there to keep battery usage down which for the average user is great. Another angle to this is app developers who create enterprise apps (apps that are not distributed via the app store but through a local server to company employes) can use these multitasking technologies however they want without fear of rejection from apple. So you can make that AIM client you always wanted. Just make sure you convince your boss its for business purposes.