October 22, 2017

Develop for Windows 10 Q&A – (6) Background Tasks

ja

 

This Q&A is related to video #14 (Background Execution) in Jerry Nixon and Andy Wigley’s A Developer’s Guide for Windows 10. There are many details in the video about how to register background tasks, setup triggers and conditions. But I will skip that, only list some general concepts. I want this post to be a pointer to further reading. Reason is not everyone need background tasks, it is only used in some cases.

Q. Why Background Execution?
A. Background tasks are invoked by the OS from certain triggers and under certain conditions. If your app need to catch this situation while the app is not running, you register a background task to the OS. Background task can be part of the app itself, or a separate process. A background task doesn’t need a UI. It may not interact with the user.

Q. What’s limitation with Background Execution?
A. Background Execution is not guaranteed, so it is not suitable for critical functions and features. The OS has a limitation of how many background tasks can run at the same time. So even trigger is fired and conditions are met, the task can still not get to run.

Q. What happens when trigger is missed?
A. When a trigger is missed by any chance, it is not buffered for next time. Your task will have to wait for next trigger. This next trigger will run background task for this trigger only, not the previous ones, ignoring the missed trigger.

The video gives some details on how to create and register background tasks. More details will be available on MSDN after Windows 10 and Visual Studio 2015 release.