Download “Introduction to background tasks - Guidelines for developers”
Some aspects for Metro apps in Windows 8 can remain active and continue running even if the user has pushed them to the background, suspending them.The new Metro platform of the next major iteration of the Windows client suspends any opened Metro apps that customers are not using, providing a fully immersive experience only for the application that’s in focus.
“The foreground app is assumed to be the most important to the user, so this app receives all the resources of the system,” Microsoft reveals.
This is a new app behavior for Windows, and the vast majority of suspended apps will not run any code, and thus, not consume hardware resources, or drain the battery.
“A suspended app remains suspended until the user resumes it by bringing the app back to the foreground. With this model of app behavior, the user experience is never impacted by lags or delays caused by the execution of unimportant background apps,” the company explained.
“In addition, reducing unnecessary background activity optimizes battery life on a variety of form factors. The time taken to resume a suspended app is negligible and would appear to be almost instantaneous to most users.”
At the same time, there are a number of scenarios in which Metro apps, even if suspended, need to continue performing specific operations.
Thanks to Background Tasks, developers can equip their projects with this type of functionality, Microsoft revealed.
The Redmond company is even offering a free whitepaper dubbed “Introduction to Background Tasks” via the Download Center, to provide devs with insight into how to get their suspended apps to still run code.
“Windows Developer Preview provides a number of features to make an app look alive with content even when the app is suspended:
• Windows push notifications can be used to keep the app tile fresh and up-to-date.
• Playback Manager can be used to play audio in the background.
• The background transfer API can be used to download and upload files in the background.
• File share contracts can be used to share data between apps,” the company added.
Windows 8 Developer Preview Build 8102 Milestone 3 (M3) is available for download here.