Windows 8 may be running Metro apps in the background when you use the OS, but that doesn't mean that those apps just have to be sitting around and doing nothing (metaphorically speaking, of course). In a new post on the Windows 8 app developer blog, Microsoft goes over some ways Windows 8 app programmers can allow their products to be doing something useful, even if they are not actively running in the foreground.
While Windows 8 has been designed to offer users the best battery life if it is being used inside a notebook or tablet, Windows 8 Metro apps can still work in the background to do things such as downloading or uploading files or running music or other audio files. In terms of file transfers, the blog states:
The BackgroundTransfer namespace provides a simple and rich API that you can use for transferring data both in the foreground and background. The API does a lot of the hard work for you, so you can focus on what your app does best. It’s optimized for power efficiency, is resilient to network glitches, and is network cost aware.
Microsoft offers up some example code in the blog that will allow Metro app makers to put in that kind of feature in their software creations. In terms of running audio in the background while working on another app, Microsoft states:
In Windows 8, we made it really easy for you to develop an app that plays audio in a simple and power efficient manner. Windows 8 provides system level controls that are designed to improve the user experience within the MediaControl class, using stream categorization, and media transport controls.
Putting in background audio support can be done by adding the background audio declaration in the app manifest, setting the stream category (msAudioCategory) to either Communications or BackgroundCapableMedia and then registering the app for media transport controls. The blog post goes into detail on how to accomplish all three tasks.
Microsoft plans to release more information about how Windows 8 Metro apps can perform other background tasks in future blog posts.
7 Comments - Add comment