1

I am working on background music, streaming music from website. I am trying to get info about music every 3 seconds from web, even when the app is closed. Everything is working except my ticker which is not working in background.

This is my code:

public sealed class AudioTask : IBackgroundTask
{
     #region Music properties
     private void setTicker()
     {
          AutoResetEvent _refreshWaiter = new AutoResetEvent(true);
          dispatcherTimer = new DispatcherTimer();
          dispatcherTimer.Tick += dispatcherTimer_Tick;
          dispatcherTimer.Interval = new TimeSpan(0, 0, 3);
          dispatcherTimer.Start();
      }

      private void dispatcherTimer_Tick(object sender, object e)
      {
          GetInfoAboutMusic();
      }
}

Maybe there is something like DispatcherTime? What do I have to use?

Piotr Chojnacki
  • 6,837
  • 5
  • 34
  • 65
Jacek Grzelaczyk
  • 783
  • 2
  • 9
  • 21

1 Answers1

0

Without seeing more code, it is hard to make a proper suggestion. You should read this aticle on Background Tasks in Windows Store Apps and others you can find that reference IBackgroundTask.

There is also How to play background music in windows phone 8.1 with xaml and c#? which has some good info that may get you unblocked.

Community
  • 1
  • 1
Kory Gill
  • 6,993
  • 1
  • 25
  • 33