Multitasking - Similarities / Differences
(been working on this for a while. Going to do some updates tomorrow.)
Both do multitasking in a fairly similar way.
iPhone
Most things are not running in the background.
http://www.iphonehacks.com/2012/01/developer-clears-misconceptions-about-ios-multitasking.html
5 states
the_link_above said:
Not running - the app has been terminated or has not been launched.
Inactive - the app is in the foreground but not receiving events (for example, the user has locked the device with the app active)
Active - the normal state of "in use" for an app
Background - the app is no longer on-screen but is still executing code
Suspended - the app is still resident in memory but is not executing code
The only way an app can run in the background is:
the_link_above said:
it usually moves to the Suspended state within 5 seconds unless the app informs iOS that it is starting a background task. Even in such cases the apps don't run indefinitely but are given approximately 10 mins by the iOS to finish the background task after which they're forcibly suspended by iOS.
However, there are 5 kinds of apps that are an exception to the rule:
- Audio: Allowingusers to use radio apps like Pandora, InstaCast in the background while they're using iPhone's Safari browser to surf the web etc.
- VoIP: This will allow VoiP apps like Skype to run in the background so that it users can receive and make calls even when they're running in the background.
- Location: Apps that need to constantly track your GPS coordinates can now run in the background while you listen to music or surf the internet.
- Newsstand apps that are downloading new content.
- Apps that receive continuous updates from an external accessory in the Background
Mango
Any app can create a PeriodicTask which will run for upto 25 seconds every 30 minutes. There is also ResourceIntensiveTask, but that requires external power and WiFi or PC for internet.
http://msdn.microsoft.com/en-us/library/hh202942(v=VS.92).aspx
Files can be downloaded in the background
http://msdn.microsoft.com/en-us/library/hh202955(v=VS.92).aspx
Audio apps can run in the background.
http://msdn.microsoft.com/en-us/library/hh394039(v=VS.92).aspx
Alarms and Reminders can be scheduled.
http://msdn.microsoft.com/en-us/library/hh220736(v=VS.92).aspx
Location can be accessed in the background, but it is cached information which is updated every 15 minutes:
http://msdn.microsoft.com/en-us/library/hh202962(v=VS.92).aspx
iPhone Advantages:
Mango cannot run for an extra 10 minutes after being put in the background.
Mango cannot do VoIP in the background.
Mango cannot do real time GPS in the background.
Mango cannot monitor something like the battery in realtime in the background.
The task switcher on iOS offers the ability to purge suspended and/or background running apps from memory without bringing the app to the foreground. WP7 lacks this ability today.
iOS brings suspended apps up quickly to the state when suspended quickly, even if it actually terminated. (I suspect the state was fully saved since any process can ask for 10 minutes of background process time).
iOS allows terminating of more than 1 app at a time by using multitouch.
Mango Advantages:
Mango can exit the running application directly with the Back button. With the iPhone, you must leace the app (tap the button) Then double tap the button.
Similarities
Typical apps do not run in the background. Only select types do.
Mango has Fast Application Switching, which is alot like the Suspended state of the iPhone and it is very easy for developers to support this.
http://channel9.msdn.com/Series/Get...ding-FAS-to-a-Typical-Silverlight-Application
Both can recieve notifications to start when not running, which will only start if the user responds.
3rd party apps on iOS can schedule reminders (not sure about alarms, though).
Differences:
Windows Phone 7 automatically terminates apps after 6 are suspended. When an app is removed from the list it is terminated and must be reloaded from scratch.
iPhone keeps all apps that have been opened.
I think it is interesting that the actual killing of apps is the opposite. The iPhone can only kill the background apps. Mango can only kill the foreground app.
Note:
Windows Phone 7 took the stand to protect the user from apps that can potentially depleat the battery quickly. Windows Mobile was plagued with apps that did this. Before Mango, they did not even allow Alarms, Reminders, or Background Audio from 3rd party devs. The iPhone gives devs a little more freedom and the user must make the decision about what they run in the background.