Quantcast
Viewing latest article 40
Browse Latest Browse All 100

Adding Background Audio Capability to Windows Store Apps

Image may be NSFW.
Clik here to view.
tips word in wood type

If you’re building a Windows Store app that plays audio you have the option of being able to play your app’s audio in the background (i.e. when the app is not running).Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Over the course of three posts I want to share some tips and tricks you can use for enabling your apps to run audio in the background and make it through the Windows Store certification process. In this post I’ll show you how to enable background audio in your apps. Essentially there are two things you need to do. First you’ll need to add the capability to your application’s manifest. These can be done via the following steps:

  1. Open your application’s manifest (that’s the Package.appxmanifest file)
  2. Click on the Declarations tab
  3. Select Background Tasks from the Available Declarations drop down and click Add
  4. Check the Audio checkbox and enter either an Entry point or Start page

Image may be NSFW.
Clik here to view.
image

This will result in the following being added to the xml of the manifest :

Image may be NSFW.
Clik here to view.
image

You need to do one more thing in order to make it work. You’ll need to find the MediaElement that will be playing the audio and set its AudioCategory to BackgroundCapableMedia. If you’re doing so in XAML it will look like this:

Image may be NSFW.
Clik here to view.
image

Congratulations! Your app can now play background audio. Warning! Your app will not pass certification…yet. To get into the store your app will need to register for media transport controls as well as consider handling sound level notification events. More on those in upcoming posts. Additional Resources:


Viewing latest article 40
Browse Latest Browse All 100

Trending Articles