SlideShare a Scribd company logo
WP7 Mango multitasking and “multitasking”
Cătălin Gheorghiu
October 20, 2011
Agenda
• What we will not talk about
• What is multitasking or the great picture
• WP 7 multitasking or life ain’t fair
• WP 7 Application Lifecycle or our case
• Mango dormant state or the novelty
• Mango background task or the news
• Q&A
What we will not talk about &
What is multitasking or the great picture
WP 7 multitasking or life ain’t fair
WP 7 multitasking
• The Windows Phone platform uses a multi-
tasking operating system (so far so good)
• However, this multi-tasking ability is not extended
to applications that we write (small print at the
bottom)
• Although we can have something that can run in
the background (a solution)
WP 7 Application Lifecycle or our case
Application Lifecycle
http://msdn.microsoft.com/en-us/library/ff817008(v=vs.92).aspx
Application Lifecycle
Application Lifecycle
<Application.ApplicationLifetimeObjects>
<shell:PhoneApplicationService
Launching="Application_Launching"
Closing="Application_Closing"
Activated="Application_Activated“
Deactivated="Application_Deactivated"/>
</Application.ApplicationLifetimeObjects>
Demo(s)
Mango dormant state or the novelty
Mango dormant state
• An application will receive events to notify it of changes to
state (same for tombstone and dormant)
• It can also use status information when it resumes (to
know if tombstone or dormant)
• It has access to memory space to save transient state
and isolated storage to persist application state (does not
know if is going to sleep or put to sleep)
• Beware an app even dormant could very well not get
activated again
Demo(s)
Mango background task or the news
Mango background state
• A Windows Phone application can start ONE “background
agent” to work for it (with limitations in what it can do and
the access it has to the processor and other phone
facilities).
Think about them as app own shadow windows service
– It is a PeriodicTask, ResourceIntesiveTask or both at
the same time
• The agent can run when the main application is not in the
foreground
• An agent is not equivalent to a foreground application
running in the background
Mango background state
• The number of agents allowed to be active at one time is
restricted by the Windows Phone operating system
• If the right conditions do not arise for an agent it will not
be started or will stop running
– Background agents only run in situations where the
operating system feels able to give them access to the
processor
– If the phone goes into “Power Saver” mode it may stop
running background agents completely
• Users can also manage the agents running on their phone
and may chose to disable them
Mango background state
• A Task is the container that is managed by the operating
system and runs at the appointed time and it runs an
Agent which is the actual code payload which does the
work
– The agent code is called as a method in a class
– The class is created as part of a Scheduled Task
Agent Project
• There are two kinds of Task
– Periodic tasks that are run every now and then
– Resource intensive tasks that run when the phone is in
a position to let them
Mango background task
• PeriodicTask Agent runs every now and then
– Typically every 30 minutes or so, depending on loading
on the phone
• It is intended to perform a task that should be performed
regularly and complete quickly (is allowed to run for 15
seconds or so)
– The phone sets a limit on the maximum number of
active agents at any time
• Good for location tracking, polling background services
Mango background state
• Resource Intensive Agents run when the phone is in a
position where it can usefully perform some data
processing (but up to 10 minutes):
– When the phone is powered by the mains
– When the phone is connected to WiFi
– When the phone is not being used (Lock screen
displayed)
• Good for synchronization with a host service,
unpacking/preparing resources, compressing databases
Mango background task
• It is possible for an application to perform both periodic
and resource intensive work in the background
(remember just ONE Agent per app)
• This can be achieved using a single background agent
class, run from both kinds of task
• The agent will run periodically and when the phone is in a
position to allow resource intensive work
• When the agent starts it can determine the context in
which it is running and then behave appropriately
Demo(s)
Q&A
Thank you for your
attention.
Contact:
•My Blog http://ronua.ro/CS/blogs/catalin/default.aspx
•My Email catalin.gheorghiu@ronua.ro
Microsoft Serbia and MT:S
proudly presents...
WP7 prize contest
• Contest will start in October and will be finished in
December
• Prizes: 4 Windows Phone handsets, Microsoft
hardware!
• Apps will be published on Marketplace
• More info after Sinergija at Sinergija portal,
microsoft.com/serbia and msacademic.rs
• Follow @mssinergija, @MicrosoftSrbija or
@msacademic
• CREATE. WIN. HAVE FUN.
Microsoft and
Open Source
gateway for deeper
exploration of open
source engagements
http://www.microsoft.com/
openness
Port25
blogs from the platform
community and the
OSS Lab teams
http://Port25.technet.com
Codeplex
resources for
developers and
consumers of open
source projects
http://www.codeplex.com
Interoperability
Bridges
technical collaborative
works
http://www.interoperability
bridges.com
Open Up
cross-Industry
Interoperability and
Standards activities
http://www.microsoft.com/
interop/openup
Shared Source
portal for
programmatically
sharing code
http://www.microsoft.com/
sharedsource
OData
open source starter kit
for Internet publishing of
Government datasets
using the Open Data
http://ogdisdk.cloudapp.net
Open Spec
protocols, file formats,
standards, technical
specifications
http://www.microsoft.com/
openspecifications
BizSpark
Program for Start-Up
companies from both
commercial and open
source backgrounds
http://www.microsoft.com/
bizspark
Openness and Interoperability @Microsoft
How can I receive up-to-date Openness announcements from Microsoft?
In addition to the websites above, you can receive regular updates to Microsoft’s
openness, interoperability and standards efforts via the following channels:
• http://blogs.technet.com/b/openness/
• http://blogs.msdn.com/b/interoperability/
• http://twitter.com/OpenAtMicrosoft
• http://port25.technet.com
• http://channel9.msdn.com/Blogs/Interoperability
Help us choose the best Sinergija
lecturer! Telekom Srbija and
Microsoft will award you – at the
conference end, we’ll give one HTC
Mozart WP7 phone to someone
from the audience – randomly.
Go to www.mssinergija.net, log in
and cast your votes.
Please rate this lecture
and WIN HTC MOZART!
You can rate only lectures that you were present at, just once. More lectures you rate, more chances you have.
Please use computers at the front of this room, or rate lecture from your phone or home computer, at Sinergija portal.
This prize contest will end at Thursday, October 20th at 9 PM. Winner will be announced at the official Sinergija web portal,
www.mssinergija.net
is a friend of Sinergija 2011
Conference and Imagine Cup
student competition in Serbia.

More Related Content

PPTX
AISEC 12 april 2012 WP 7.1.1
PPTX
NFC exchange workshop
PPTX
How to Break your App - Best Practices in Mobile App Testing
PPTX
News scavenger a SharePoint and Apps Story
PDF
Appium Native Application Crawler
PPTX
Iasi 15 noiembrie 2009 Introduction to Windows Mobile programming
PPTX
Mobile Monday Developer Summit 2012 - Introduction to HealthVault
PPTX
Sinergija 12 Windows Phone is around the corned
AISEC 12 april 2012 WP 7.1.1
NFC exchange workshop
How to Break your App - Best Practices in Mobile App Testing
News scavenger a SharePoint and Apps Story
Appium Native Application Crawler
Iasi 15 noiembrie 2009 Introduction to Windows Mobile programming
Mobile Monday Developer Summit 2012 - Introduction to HealthVault
Sinergija 12 Windows Phone is around the corned

Similar to Sinergija 11 WP7 Mango multitasking and “multitasking” (20)

PPTX
Windows Phone 8 - 6 Background Agents
PPT
Windows Phone and mobile application development
PPTX
android development training in mumbai
PDF
Windows phone 8 session 10
PDF
The XPages Mobile Controls: What's New in Notes 9.0.1
PDF
Matt Eakin - The New Tester Skillset
PDF
Everything XControls
PPTX
Dori waldman android _course_2
PDF
Android Workshop Part 1
PDF
Service worker API
PDF
Interactive Applications in .NET
PDF
Explore Android Internals
PPTX
IBM ConnectED SPOT104: Lightning-Fast Development of Native Mobile Apps for I...
PPTX
A look behind the scenes: Windows 8 background processing
PPTX
All about that reactive ui
PPTX
Microservices: Yes or not?
PPTX
Dori waldman android _course
PDF
Embedded Firmware Design and Development, and EDLC
PDF
Monitoring and Instrumentation Strategies: Tips and Best Practices - AppSphere16
DOCX
Report hospital
Windows Phone 8 - 6 Background Agents
Windows Phone and mobile application development
android development training in mumbai
Windows phone 8 session 10
The XPages Mobile Controls: What's New in Notes 9.0.1
Matt Eakin - The New Tester Skillset
Everything XControls
Dori waldman android _course_2
Android Workshop Part 1
Service worker API
Interactive Applications in .NET
Explore Android Internals
IBM ConnectED SPOT104: Lightning-Fast Development of Native Mobile Apps for I...
A look behind the scenes: Windows 8 background processing
All about that reactive ui
Microservices: Yes or not?
Dori waldman android _course
Embedded Firmware Design and Development, and EDLC
Monitoring and Instrumentation Strategies: Tips and Best Practices - AppSphere16
Report hospital
Ad

More from Catalin Gheorghiu (20)

PPTX
MSNetwork 5 - Programiranje Windows small IoT uređaja (ARM and x86, diverse h...
PPTX
WinDays XV - Programming Windows small IoT devices (ARM and x86, diverse hard...
PPTX
Microsoft Summit 2014 Bucharest - Internet of Things - Device Side
PPTX
SQLSaturday #311 Sofia - Databases for mobile
PPTX
NFC for Windows Phone Developers, Microsoft MVP & Community Day, 18 June Mosc...
PPTX
TiMo 20 - January 2014 Windows Embedded 8 Handheld
PPTX
NetWork 4 - Windows Embedded 8 Handheld
PPTX
Tarabica 14 - Windows Embedded 8 Handheld
PPTX
RONUA Roadshow fall 2013 - Mobile medley
PPTX
NetWork 3 - HealthVault at work
PPTX
Windows Phone Week 2013 - NFC & Windows (Phone) 8
PPTX
NetWork 2 - Barkode za nase aplikacije
PPTX
Mkdotnet Codecamp 2012 - Microsoft Tag applications or “barcodes” in our appl...
PPTX
Kulendayz 2012 Windows Phone is around the corner What now?
PPTX
AISEC 12 april 2012 Introduction to Windows Embedded Handheld programming
PPTX
Sinergija 11 Microsoft Tag is not just for advertising!
PPTX
Sinergija 11 Introduction to HealthVault
PPTX
momo 19 december 2011 Modern 2d Barcodes from microsoft and 5 minutes of WP...
PPTX
ItChillOut Real wold apps with Microsft Tag
PPTX
Kulendayz 2010 Microsoft Tag Barcode for XXI century
MSNetwork 5 - Programiranje Windows small IoT uređaja (ARM and x86, diverse h...
WinDays XV - Programming Windows small IoT devices (ARM and x86, diverse hard...
Microsoft Summit 2014 Bucharest - Internet of Things - Device Side
SQLSaturday #311 Sofia - Databases for mobile
NFC for Windows Phone Developers, Microsoft MVP & Community Day, 18 June Mosc...
TiMo 20 - January 2014 Windows Embedded 8 Handheld
NetWork 4 - Windows Embedded 8 Handheld
Tarabica 14 - Windows Embedded 8 Handheld
RONUA Roadshow fall 2013 - Mobile medley
NetWork 3 - HealthVault at work
Windows Phone Week 2013 - NFC & Windows (Phone) 8
NetWork 2 - Barkode za nase aplikacije
Mkdotnet Codecamp 2012 - Microsoft Tag applications or “barcodes” in our appl...
Kulendayz 2012 Windows Phone is around the corner What now?
AISEC 12 april 2012 Introduction to Windows Embedded Handheld programming
Sinergija 11 Microsoft Tag is not just for advertising!
Sinergija 11 Introduction to HealthVault
momo 19 december 2011 Modern 2d Barcodes from microsoft and 5 minutes of WP...
ItChillOut Real wold apps with Microsft Tag
Kulendayz 2010 Microsoft Tag Barcode for XXI century
Ad

Recently uploaded (6)

DOC
证书学历UoA毕业证,澳大利亚中汇学院毕业证国外大学毕业证
PPTX
Introduction to Packet Tracer Course Overview - Aug 21 (1).pptx
DOC
Camb毕业证学历认证,格罗斯泰斯特主教大学毕业证仿冒文凭毕业证
PDF
Lesson 13- HEREDITY _ pedSAWEREGFVCXZDSASEWFigree.pdf
PDF
6-UseCfgfhgfhgfhgfhgfhfhhaseActivity.pdf
PPTX
ASMS Telecommunication company Profile
证书学历UoA毕业证,澳大利亚中汇学院毕业证国外大学毕业证
Introduction to Packet Tracer Course Overview - Aug 21 (1).pptx
Camb毕业证学历认证,格罗斯泰斯特主教大学毕业证仿冒文凭毕业证
Lesson 13- HEREDITY _ pedSAWEREGFVCXZDSASEWFigree.pdf
6-UseCfgfhgfhgfhgfhgfhfhhaseActivity.pdf
ASMS Telecommunication company Profile

Sinergija 11 WP7 Mango multitasking and “multitasking”

  • 1. WP7 Mango multitasking and “multitasking” Cătălin Gheorghiu October 20, 2011
  • 2. Agenda • What we will not talk about • What is multitasking or the great picture • WP 7 multitasking or life ain’t fair • WP 7 Application Lifecycle or our case • Mango dormant state or the novelty • Mango background task or the news • Q&A
  • 3. What we will not talk about & What is multitasking or the great picture
  • 4. WP 7 multitasking or life ain’t fair
  • 5. WP 7 multitasking • The Windows Phone platform uses a multi- tasking operating system (so far so good) • However, this multi-tasking ability is not extended to applications that we write (small print at the bottom) • Although we can have something that can run in the background (a solution)
  • 6. WP 7 Application Lifecycle or our case
  • 11. Mango dormant state or the novelty
  • 12. Mango dormant state • An application will receive events to notify it of changes to state (same for tombstone and dormant) • It can also use status information when it resumes (to know if tombstone or dormant) • It has access to memory space to save transient state and isolated storage to persist application state (does not know if is going to sleep or put to sleep) • Beware an app even dormant could very well not get activated again
  • 14. Mango background task or the news
  • 15. Mango background state • A Windows Phone application can start ONE “background agent” to work for it (with limitations in what it can do and the access it has to the processor and other phone facilities). Think about them as app own shadow windows service – It is a PeriodicTask, ResourceIntesiveTask or both at the same time • The agent can run when the main application is not in the foreground • An agent is not equivalent to a foreground application running in the background
  • 16. Mango background state • The number of agents allowed to be active at one time is restricted by the Windows Phone operating system • If the right conditions do not arise for an agent it will not be started or will stop running – Background agents only run in situations where the operating system feels able to give them access to the processor – If the phone goes into “Power Saver” mode it may stop running background agents completely • Users can also manage the agents running on their phone and may chose to disable them
  • 17. Mango background state • A Task is the container that is managed by the operating system and runs at the appointed time and it runs an Agent which is the actual code payload which does the work – The agent code is called as a method in a class – The class is created as part of a Scheduled Task Agent Project • There are two kinds of Task – Periodic tasks that are run every now and then – Resource intensive tasks that run when the phone is in a position to let them
  • 18. Mango background task • PeriodicTask Agent runs every now and then – Typically every 30 minutes or so, depending on loading on the phone • It is intended to perform a task that should be performed regularly and complete quickly (is allowed to run for 15 seconds or so) – The phone sets a limit on the maximum number of active agents at any time • Good for location tracking, polling background services
  • 19. Mango background state • Resource Intensive Agents run when the phone is in a position where it can usefully perform some data processing (but up to 10 minutes): – When the phone is powered by the mains – When the phone is connected to WiFi – When the phone is not being used (Lock screen displayed) • Good for synchronization with a host service, unpacking/preparing resources, compressing databases
  • 20. Mango background task • It is possible for an application to perform both periodic and resource intensive work in the background (remember just ONE Agent per app) • This can be achieved using a single background agent class, run from both kinds of task • The agent will run periodically and when the phone is in a position to allow resource intensive work • When the agent starts it can determine the context in which it is running and then behave appropriately
  • 22. Q&A
  • 23. Thank you for your attention. Contact: •My Blog http://ronua.ro/CS/blogs/catalin/default.aspx •My Email catalin.gheorghiu@ronua.ro
  • 24. Microsoft Serbia and MT:S proudly presents... WP7 prize contest • Contest will start in October and will be finished in December • Prizes: 4 Windows Phone handsets, Microsoft hardware! • Apps will be published on Marketplace • More info after Sinergija at Sinergija portal, microsoft.com/serbia and msacademic.rs • Follow @mssinergija, @MicrosoftSrbija or @msacademic • CREATE. WIN. HAVE FUN.
  • 25. Microsoft and Open Source gateway for deeper exploration of open source engagements http://www.microsoft.com/ openness Port25 blogs from the platform community and the OSS Lab teams http://Port25.technet.com Codeplex resources for developers and consumers of open source projects http://www.codeplex.com Interoperability Bridges technical collaborative works http://www.interoperability bridges.com Open Up cross-Industry Interoperability and Standards activities http://www.microsoft.com/ interop/openup Shared Source portal for programmatically sharing code http://www.microsoft.com/ sharedsource OData open source starter kit for Internet publishing of Government datasets using the Open Data http://ogdisdk.cloudapp.net Open Spec protocols, file formats, standards, technical specifications http://www.microsoft.com/ openspecifications BizSpark Program for Start-Up companies from both commercial and open source backgrounds http://www.microsoft.com/ bizspark Openness and Interoperability @Microsoft How can I receive up-to-date Openness announcements from Microsoft? In addition to the websites above, you can receive regular updates to Microsoft’s openness, interoperability and standards efforts via the following channels: • http://blogs.technet.com/b/openness/ • http://blogs.msdn.com/b/interoperability/ • http://twitter.com/OpenAtMicrosoft • http://port25.technet.com • http://channel9.msdn.com/Blogs/Interoperability
  • 26. Help us choose the best Sinergija lecturer! Telekom Srbija and Microsoft will award you – at the conference end, we’ll give one HTC Mozart WP7 phone to someone from the audience – randomly. Go to www.mssinergija.net, log in and cast your votes. Please rate this lecture and WIN HTC MOZART! You can rate only lectures that you were present at, just once. More lectures you rate, more chances you have. Please use computers at the front of this room, or rate lecture from your phone or home computer, at Sinergija portal. This prize contest will end at Thursday, October 20th at 9 PM. Winner will be announced at the official Sinergija web portal, www.mssinergija.net is a friend of Sinergija 2011 Conference and Imagine Cup student competition in Serbia.