I have an Internet radio app that uses BackgroundAudioPlayer
.
I need a timer in the Audio Playback Agent that will update the track title of the currently playing track of the BAP that is pulled from the Internet radio station's API.
Adding a DispatcherTimer
into the Audio Playback Agent gives me a cross-thread exception, and using:
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
// Code
});
Didn't work.
I need the code in here because if I put the update code in the app itself, when the user navigates away from the app the updates stop (much unlike Windows 8's behavior).
I can't use Scheduled Agents since they only run once every 30 minutes (IIRC).
Is this possible or can this not be done on Windows Phone?