An audio player agent can be created by selecting the Windows Phone Audio Playback Agent project type from the Visual Studio New Project dialog (see Figure 34.1). This produces a new project that includes a class that derives from AudioPlayerAgent
.
When you link to an Audio Player Agent project from your main project, a BackgroundServiceAgent
task definition is added to your main project’s WMAppManifest.xml file, resembling the following:
<Tasks>
<DefaultTask Name="_default" NavigationPage="MainPage.xaml"/>
<ExtendedTask Name="BackgroundTask">
<BackgroundServiceAgent Specifier="AudioPlayerAgent"
Name="<Unique name within the app>"
Source="<Assembly>"
Type="<Namespace.Class>" />
</ExtendedTask>
</Tasks>
It is not necessary to use Visual Studio’s Audio Player Agent project template to create a custom background audio agent. You can create the class and add the task definition to the WMAppManifest.xml file manually if you so choose.
3.17.78.157