This is a blog post that’s been pending for months but since there seems to be quite a bit of misconception around multi-tasking, I think this needs to cleared a bit. iOS4 introduced multi-tasking and WP7 has an implementation that works partly like in iOS4. Let’s compare and put multitasking in both platforms in perspective.
Multitasking in iOS4:
Quoting the iPhone programming guide:
Although most applications are suspended, applications that need to continue working in the background may do so using one of the following techniques:
- An application can request a finite amount of time to complete some important task.
- An application can declare itself as supporting specific services that require regular background execution time.
- An application can use local notifications to generate user alerts at designated times, whether or not the application is running.
This means that applications are suspended but if an application wants to perform an action after suspending it can be granted access to any of the following 7 services. Only 7:
- Background audio
- Voice over IP
- Background location
- Push notifications
- Local notifications
- Task completion
- Fast app switching
So essentially if Pandora does not code into the app that it wants access to Background Audio, it’ll be suspended once you navigate out. It won’t be running in the background like traditional multitasking.
In case an application doesn’t want invoke any of these 7 services, it will be suspended. Another keyword here, suspended.
What does suspended mean?
Simply put, the application will go into something similar to what happens when you put your PC into hibernate or sleep mode. The next time you start the application, it will start from where you left it. Probably not the best analogy, but you get the idea. The application isn’t closed. And this is exactly what Windows Phone 7 does as of now.
Multitasking in Windows Phone 7:
First up: Microsoft’s applications – email, Zune, IE can run in the background and you can continue doing different tasks.
The difference between multitasking in WP7 and iOS4 is that apps don’t have access to background services (the 7 that developers get access to in iOS4). In WP7 apps are suspended, the application state is saved and when you start it again, it’ll start from where you left it.
Microsoft calls this as hydration and de-hydration, they compare it to browser cookies where data is stored pertaining to a website. The slides that explain this:
The slide simply explains that when a user navigates away from an application by hitting the Windows key, the UI is discarded but the state is saved. The second slide:
The application can be re-started from its saved state and in case the system requires more resources, the application is terminated, very much like the iPhone.
So if I’m reading an ebook in the kindle app and i navigate out of it, the app will save where I was in the app and then quit. once I start the application again, i will be on the same page I left (provided of course Amazon codes it.) What Windows Phone 7 is lacking is the Alt+Tab UI that iOS4 has and access to some core APIs. Not that it can’t be provided.
If you’re a developer here’s a blog post on the issue that might help you. I owe it to Aayush Arya for helping me with the iOS4 part.