Shiny Silverlights

...Another Silverlight MVP blog

Windows Phone 7 and iPhone – Multitasking

Written by h6bevalge on August 15th, 2010

For almost two years our company has been developing iPhone applications. As a Silverlight MVP, seeing Windows Phone 7 support Silverlight as a development platform, is like a dream come true. So naturally the first thing to look at is what is different? In this post I’ll look at multitasking.

Multitasking

Multitasking on the Windows Phone

There hasn’t been a lot of talk about multitasking but as I understand, it is quite similar to the iPhone. Applications are in one of two states hydrated (active) or dehydrated (inactive). Developers are encouraged to save and restore application state between different events – closing, deactivationg and activating.

Closing

The application will go to the closing state when the user presses the hardware back button beyond the front page of your application. In here data that is persistent throughout app instances should be saved to isolated storage. You should not save data that is specific to current instance because this instance will never be resumed.

Closing on the iPhone
On the iPhone applications are closed (applicationWillTerminate:) when the user explicitly closes them from the multitasking UI or when the app is running on older systems that don’t support multitasking. Application may also be closed when the state saving is taking too long (> 5 sec).

Deactivating

Windows Phone application will go to deactivated state when the user presses the start-button, the app is killed for saving persistent data too long (10 secs is the max) and when the user is using a Launcher or a Chooser. Application may but might not be resumed after this state.

Application will not be resumed when the user starts a new instance by picking the same app from the app list again, or when many apps are opened in a row and your app could no longer be reached using the hardware back button.

So you are assumed to be saving app state before launching a chooser or launcher.

Deactivating on the iPhone

Multitasking on the iPhone

Multitasking on the iPhone

Apple also has a time-limit for saving application state – 5 seconds. What is different is that Windows Phone deactivates your application when you initialize e-mail sending (use Launchers or Choosers). On the iPhone sending an e-mail is part of your application and only way away from the e-mail app initialized from your app  MFMailComposeViewController is through your app. You get an event that the e-mail composing was finished. The same applies with image and video pickers on the iPhone, but on Windows Phone, you send your user to pick an image, send an e-mail and might never see the user again.

Another difference is that on Windows Phone you can always “restart” an application by starting a new instance of it by choosing it from the application list. On the iPhone when you tap on the icon of a running app you get the running instance of that app not a new one.

Activating

Your Windows Phone app enters the activating state when:

  • the user finished using a Chooser or Launcher.
  • user launched a new app and now pressed the hardware back button enough times to reach your app.

Now your app should restore saved state from PhoneApplication.State and the user should never know that the application stopped running.

Activating on the iPhone

On the iPhone there really isn’t a built in mechanism for state saving, you get the events applicationWillResignActive:, applicationDidEnterBackground: and applicationDidBecomeActive: but within those it is really your task to somehow save the state.

1 Comments so far ↓

  1. [...] This post was mentioned on Twitter by zunecards and Ashley J. Camidge, Jaana Metsamaa. Jaana Metsamaa said: New blog post: Windows Phone 7 and iPhone – Multitasking http://silverlight.riiul.com/2010/08/15/windows-phone-7-and-iphone-multitasking/ [...]

  2. [...] Windows Phone and iPhone – Multitaksing August 20, 2010 – 09:12 | By h6bevalge | Posted in Comparison, Windows Phone, iPhone | Comments (0) ← Windows Phone 7 and iPhone – Multitasking [...]

  3. ManniAT says:

    You didn’t work out the real things.
    On the iPhone multitasking exists in “user applications” while on windows phone 7 this is limited to “builtin” tasks (Phone and such things).
    So I can build an app for the iPhone which really runs in the background while I can’t do this with wp7.
    Furhter using this feature I can get plenty more time to save my “app state” – you told 5 seconds.
    And last not least there is (good) support to save app state as well as “user preferences” on the iPhone.
    And more – these settings can be save with iTunes and so setting up a new device (for an example in the case of loosing it) is done with a few clicks – including all my previous settings / data.

  4. progg.ru says:

    Windows Phone 7 ? iPhone – ??????????????…

    Thank you for submitting this cool story – Trackback from progg.ru…

Leave a Comment





4 Trackbacks / Pingbacks

  1. Tweets that mention Windows Phone 7 and iPhone – Multitasking – Shiny Silverlights -- Topsy.com
  2. Windows Phone 7 and iPhone – Views and navigation – Shiny Silverlights
  3. progg.ru
  4. ???????? ??????????? ?????????? #5 (Windows Phone 7) - Oleksandr Krakovetskiy blog - Microsoft User Group ???????