SlideShare a Scribd company logo
Multitasking and Triggered Background
Processing in Windows Phone 8.1
Rob Irving
Senior Software Engineer – ALK Technologies
Microsoft MVP – Windows Platform Development
www.robwirving.com
@robwirving
Rob Irving
• Senior Software Engineer at ALK Technologies
• Microsoft MVP – Windows Platform Development
• Led development effort to bring CoPilot GPS
navigation app to Windows Phone 8
• In top 10 Free Navigation Apps in Window Phone store
• Windows Phone Dev by day and night
• Released 7 of my own apps to Windows Phone store
• http://bit.ly/AppsByRWI
• Blog: www.robwirving.com
• Twitter: @robwirving
Agenda
• What are Background Tasks
• History on Windows Phone 8
• What’s new in Windows Phone 8.1
• Triggered Background Tasks
• Geofencing
• XAML Tile Rendering
Multitasking and Triggered Background Processing in Windows Phone 8.1
Multitasking and Triggered Background Processing in Windows Phone 8.1
1.
2.
3.
4.
PeriodicTask, ResourceIntensiveTask
Multitasking and Triggered Background Processing in Windows Phone 8.1
Hosted in a separate process
One trigger per task, multiple
conditions
Trigger Usage
System Trigger
UserPresent , UserAway,
SessionConnected,
TimeZoneChange,
NetworkStateChange,
InternetAvailable,
ServicingComplete
Run code on system events
TimeTrigger Data synchronization
MaintenanceTrigger Perform maintenance work on AC power
Multitasking and Triggered Background Processing in Windows Phone 8.1
Multitasking and Triggered Background Processing in Windows Phone 8.1
Multitasking and Triggered Background Processing in Windows Phone 8.1
Multitasking and Triggered Background Processing in Windows Phone 8.1
Multitasking and Triggered Background Processing in Windows Phone 8.1



Geofence notifications can be received in the
background by a background task
new
new "LincolnSquareStore"
new
new
Id Required String N/A
Geoshape Required
Geocircle
(BasicGeoposition + Radius)
N/A
MonitoredStates Optional Entered/Exited/Removed Entered/Exited
SingleUse Optional True/False False
DwellTime Optional Timespan 10s
StartTime Optional DateTimeOffset 0/epoch
Duration Optional Timespan 0/forever
Multitasking and Triggered Background Processing in Windows Phone 8.1
Render a Tile from your BackgroundTask!
New class XamlRenderingBackgroundTask
BackgroundTask + XAML Visual Tree
Use RenderTargetBitmap to render XAML visual tree
Multitasking and Triggered Background Processing in Windows Phone 8.1
Multitasking and Triggered Background Processing in Windows Phone 8.1
Multitasking and Triggered Background Processing in Windows Phone 8.1
Multitasking and Triggered Background Processing in Windows Phone 8.1
Multitasking and Triggered Background Processing in Windows Phone 8.1
Multitasking and Triggered Background Processing in Windows Phone 8.1
New in Windows Phone 8.1
Sort and manage which apps can
execute in the background
Controls number of apps that can
run in the background
Quotas are based on actual CPU usage instead of wall clock
time limits only
Wall-clock CPU quota will also be enforced (at least 30 secs)
Memory quota scales based on device capabilities
TimeTrigger will have a 30 min floor on Phone
Call RequestAccessAsync() to get your full quota!
Multitasking and Triggered Background Processing in Windows Phone 8.1

channel9.msdn.com/Events/Build/2014

www.robwirving.com

@robwirving

bit.ly/AppsByRWI

linkedin.com/in/robwirving

slideshare.net/robwirving

1drv.ms/1oW9KYn

More Related Content

PDF
Docker Containers - Talk Linux Day 2015
PPTX
Project a day 1 introduction to android
PDF
Buck outside Valley
PPTX
C#: Past, Present and Future
PDF
Preparing for Growth - Architecting Giant Apps for Scalability and Build Speed
PPTX
Packer, Terraform & Jenkins - DevOpsBelfast March 2019
PPTX
(WPF + WinForms) * .NET Core = Modern Desktop
PDF
Merge hells!! Feature toggles to the rescue - DevOpsDays Madison
Docker Containers - Talk Linux Day 2015
Project a day 1 introduction to android
Buck outside Valley
C#: Past, Present and Future
Preparing for Growth - Architecting Giant Apps for Scalability and Build Speed
Packer, Terraform & Jenkins - DevOpsBelfast March 2019
(WPF + WinForms) * .NET Core = Modern Desktop
Merge hells!! Feature toggles to the rescue - DevOpsDays Madison

What's hot (20)

PDF
Merge hells!! feature toggles to the rescue - Presented @ Agile Toronto
ODP
Jenkins CI in Action
PPTX
Revolutionize Your Workflow with ChatOps
PDF
SplunkLive Brisbane Splunk for Developers
PDF
SplunkLive Melbourne Splunk for Developers
KEY
勝敗は常に見積もりで決まる〜Redmineを使った時間記録の話
PPTX
Building Realtime Mobile Apps with React Native and Elixir
PDF
Improving the Pharo VM
PPT
Cross platform native development with appcelerator titanium (2014 devnexus)
PDF
How open source is driving DevOps innovation: CloudOpen NA 2015
PDF
Mikrofrontend a Module Federation
PDF
More Productivitiy with Spring Roo
PPTX
Ciprian redinciuc continuous integration with jenkins for i os
PDF
2013 t-dose - libre office easyhacks
PPTX
Provisioning environments. A simplistic approach
PDF
LinkedIn's Consistent Android Testing Environments Using Gradle
PDF
3x3: Speeding Up Mobile Releases
PPTX
ASP.NET 5 on the Raspberry PI 2
PPTX
Building Chatbots
PDF
Continuous delivery of embedded systems embedded meetup
Merge hells!! feature toggles to the rescue - Presented @ Agile Toronto
Jenkins CI in Action
Revolutionize Your Workflow with ChatOps
SplunkLive Brisbane Splunk for Developers
SplunkLive Melbourne Splunk for Developers
勝敗は常に見積もりで決まる〜Redmineを使った時間記録の話
Building Realtime Mobile Apps with React Native and Elixir
Improving the Pharo VM
Cross platform native development with appcelerator titanium (2014 devnexus)
How open source is driving DevOps innovation: CloudOpen NA 2015
Mikrofrontend a Module Federation
More Productivitiy with Spring Roo
Ciprian redinciuc continuous integration with jenkins for i os
2013 t-dose - libre office easyhacks
Provisioning environments. A simplistic approach
LinkedIn's Consistent Android Testing Environments Using Gradle
3x3: Speeding Up Mobile Releases
ASP.NET 5 on the Raspberry PI 2
Building Chatbots
Continuous delivery of embedded systems embedded meetup
Ad

Viewers also liked (8)

PDF
Multitasking
PPT
Multitasking presentation
DOCX
Psychology
PPTX
Multi tasking ppt
PPTX
Psych 101 - Introduction to Psychology - Lecture 1
PPTX
Introduction to general psychology
PPTX
Experimental Psychology
PPT
Introduction to psychology
Multitasking
Multitasking presentation
Psychology
Multi tasking ppt
Psych 101 - Introduction to Psychology - Lecture 1
Introduction to general psychology
Experimental Psychology
Introduction to psychology
Ad

Similar to Multitasking and Triggered Background Processing in Windows Phone 8.1 (14)

PPTX
11 background tasks and multitasking
PPTX
A look behind the scenes: Windows 8 background processing
PPTX
Фоновые задачи и многозадачность для Windows Phone
PPTX
Vunvulea radu it camp-ro 2012 - building metro style applications on window...
PDF
Windows Phone 8 Fundamental
PPTX
Beat the Clock: Background Tasking in Windows 8
PDF
ITCamp 2012 - Radu Vunvulea - Building metro style applications on Windows 8 ...
PPTX
A lap around Windows Phone 8.1
PDF
follow-app BOOTCAMP 2: Windows phone fast application switching
PPTX
PLM and Background Tasks by Jason Fox
PPTX
09 wp7 multitasking
PPTX
Windows 8 BootCamp
PDF
#win8aca : How and when metro style apps run
PPTX
Cool Stuff Your App Can Do
11 background tasks and multitasking
A look behind the scenes: Windows 8 background processing
Фоновые задачи и многозадачность для Windows Phone
Vunvulea radu it camp-ro 2012 - building metro style applications on window...
Windows Phone 8 Fundamental
Beat the Clock: Background Tasking in Windows 8
ITCamp 2012 - Radu Vunvulea - Building metro style applications on Windows 8 ...
A lap around Windows Phone 8.1
follow-app BOOTCAMP 2: Windows phone fast application switching
PLM and Background Tasks by Jason Fox
09 wp7 multitasking
Windows 8 BootCamp
#win8aca : How and when metro style apps run
Cool Stuff Your App Can Do

Recently uploaded (20)

PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
top salesforce developer skills in 2025.pdf
PPTX
history of c programming in notes for students .pptx
PPTX
ai tools demonstartion for schools and inter college
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
medical staffing services at VALiNTRY
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Digital Strategies for Manufacturing Companies
PDF
System and Network Administration Chapter 2
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Nekopoi APK 2025 free lastest update
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Design an Analysis of Algorithms I-SECS-1021-03
VVF-Customer-Presentation2025-Ver1.9.pptx
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
top salesforce developer skills in 2025.pdf
history of c programming in notes for students .pptx
ai tools demonstartion for schools and inter college
How to Migrate SBCGlobal Email to Yahoo Easily
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Wondershare Filmora 15 Crack With Activation Key [2025
medical staffing services at VALiNTRY
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Odoo Companies in India – Driving Business Transformation.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Digital Strategies for Manufacturing Companies
System and Network Administration Chapter 2
Navsoft: AI-Powered Business Solutions & Custom Software Development
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Nekopoi APK 2025 free lastest update
CHAPTER 2 - PM Management and IT Context
Design an Analysis of Algorithms I-SECS-1021-03

Multitasking and Triggered Background Processing in Windows Phone 8.1

  • 1. Multitasking and Triggered Background Processing in Windows Phone 8.1 Rob Irving Senior Software Engineer – ALK Technologies Microsoft MVP – Windows Platform Development www.robwirving.com @robwirving
  • 2. Rob Irving • Senior Software Engineer at ALK Technologies • Microsoft MVP – Windows Platform Development • Led development effort to bring CoPilot GPS navigation app to Windows Phone 8 • In top 10 Free Navigation Apps in Window Phone store • Windows Phone Dev by day and night • Released 7 of my own apps to Windows Phone store • http://bit.ly/AppsByRWI • Blog: www.robwirving.com • Twitter: @robwirving
  • 3. Agenda • What are Background Tasks • History on Windows Phone 8 • What’s new in Windows Phone 8.1 • Triggered Background Tasks • Geofencing • XAML Tile Rendering
  • 9. Hosted in a separate process One trigger per task, multiple conditions
  • 10. Trigger Usage System Trigger UserPresent , UserAway, SessionConnected, TimeZoneChange, NetworkStateChange, InternetAvailable, ServicingComplete Run code on system events TimeTrigger Data synchronization MaintenanceTrigger Perform maintenance work on AC power
  • 17. Geofence notifications can be received in the background by a background task new new "LincolnSquareStore" new new
  • 18. Id Required String N/A Geoshape Required Geocircle (BasicGeoposition + Radius) N/A MonitoredStates Optional Entered/Exited/Removed Entered/Exited SingleUse Optional True/False False DwellTime Optional Timespan 10s StartTime Optional DateTimeOffset 0/epoch Duration Optional Timespan 0/forever
  • 20. Render a Tile from your BackgroundTask! New class XamlRenderingBackgroundTask BackgroundTask + XAML Visual Tree Use RenderTargetBitmap to render XAML visual tree
  • 27. New in Windows Phone 8.1 Sort and manage which apps can execute in the background Controls number of apps that can run in the background
  • 28. Quotas are based on actual CPU usage instead of wall clock time limits only Wall-clock CPU quota will also be enforced (at least 30 secs) Memory quota scales based on device capabilities TimeTrigger will have a 30 min floor on Phone Call RequestAccessAsync() to get your full quota!

Editor's Notes

  • #5: Anytime app is running code while not in foreground Great way to enhance user experience, get users to interact with your app
  • #6: History of Multitasking in Windows Phone 7 & 8
  • #7: Windows Phone 7 didn’t really have multitasking Windows Phone 8 added new mechanisms to provide content when not in the foreground app Live tiles or toasts – triggered by push notifications or scheduled OS Brokered tasks like background downloads Background tasks and agents which would run periodically
  • #8: In WP8 we had PeriodicTasks and ResourceIntensiveTasks which would run periodically every half hour or so. Could be used to download new content for the user, update tiles, etc. Background Transfer Service allowed you to download large files while not in the foreground Background location tracking is a special exception for navigation apps like CoPilot. As long as these apps are still actively using the GPS they would be allowed to continue running while not in the foreground. VOIP and Audio Agents were another special case of background execution for apps like Skype or Pandora.
  • #10: The new Windows Runtime Background execution model is centered around Background Tasks. Rather then running periodically they respond to triggers or conditions. This is a converged API, so it’s the same background tasks that are available for Windows Apps. Because it’s a converged API you do need to request access to run in the background.. On Windows this would display a popup, but on Windows Phone there’s no UI. You still need to check though, and there are certain conditions that would cause background access to not be granted, such as if the user disabled your app through the battery saver settings.
  • #11: Here are some of the different triggers available. If you’ve done any development with Windows Store apps these may be familiar because it is a converged API. Go over System Triggers TimeTrigger run task on an interval, must specify atleast a 30 minute intervals, but on windows phone interval will usually be no less then half an hour. Maintenance Trigger similar to the resource intensive task, run resource intensive code when the phone is plugged in
  • #12: Demo Time Demo in WP8.1 Silverlight, all of the new multitasking features for Windows Universal Apps are also available for Windows Phone Silverlight 8.1 Registering background task in C# Display available memory in C# toast At Build all the sessions I went to about background tasks told us that we should be writing our background task code in C++. Background tasks have a limited amount of memory resources available to them ~16MB, by not loading up the CLR you can save a few MBs and hopefully avoid Out of Memory exceptions. You can still write your apps in C#, but the nice thing about the Windows Runtime is that you can interoperate between C#, C++ and even WinJS really easily. Convert C# Background Task into a C++ project Modify code and manifest to register C++ background task
  • #13: All of the tasks I’ve showed you so far were already there for Windows Store, so now we’ll go into some new forms of multitasking
  • #14: All this is available for Silverlight 8.1. So if you’re already invested with apps developed in Windows Phone 8, like I am. Then you can still benefit from all these new background tasks without having to migrate to the Windows Univeral App Model. When you upgrade to 8.1 your 8.0 style background agents will be hosted on top of the modern background infrastructure and should run better with the newer resource management. Note that you should make sure you don’t have a mix of 8.0 BG Agents and 8.1 BG Tasks as conflicts will occur with mixing the Silverlight CLR and WinRT CLR. If you write your BG Agent/Task code in C++ though you’ll be fine.
  • #15: Not a Bluetooth expert so I don’t have a demo to show about any of the new Bluetooth functionality here, but I’m really excited about it. Bluetooth LE is a new feature for Windows Phone 8.1 it should be available in many of the newer phones, Lumia Icon, 930, 1520 and 630. Bluetooth triggers are based on existing WinRT Bluetooth APIs DeviceChange is pretty self explanatory if a Device connects or reconnects to the phone this trigger will be raised DeviceUpdate trigger is going to be core to how fitness apps like FitBit could integrate with Windows Phone. With these you’ll be able to have a long running background task that communicates with Bluetooth LE devices like heart rate monitors or pedometers
  • #16: You can now have your app setup a Windows Notification Service channel and associate it with a background task Then any raw push notifications that come through on that channel will activate the background task. This can be really useful for news reader applications or social media like twitter or facebook. I know one thing that frustrates me with twitter is that I’ll see a notification come through from twitter, and click on it to activate the app. When I go into the app though it still needs to connect to the service and fetch the new tweets. With these new background tasks that handle RAW notifications a service like twitter could get the notification, connect to the service to refresh content and THEN show a toast notification to let me know that someone mentioned me. It’ll make the app appear more responsive to me, even though in reality I’m getting my toast notification a second or two later.
  • #21: One of the things done most frequently with periodic tasks in WP8.0 was updating tiles. A lot of developers would take some XAML, render it to a bitmap and then update a tile with that bitmap. If you’ve done any development on Windows 8 you might know that this wasn’t possible with Windows 8 background tasks. It’s not possible to access the XAML tree there. So a new type of background task is available for Windows Phone that gives access to the XAML visual tree. So in this background task you’ll basically create some XAML, use RenderTargetBitmap to render the XAML to a PNG and then you can use that PNG to update your tile
  • #22: So the interesting thing about this demo is that Microsoft wants you to use C++ for XamlRenderingBackgroundTasks so much that they didn’t make a C# version of the sample code. But when working on this presentation I was curious about what the memory savings would look like in a more complex demo like this, so I converted the C++ task into a C# one to compare them.