how to run periodic tasks every 5 minutes or more frequently in windows phone 8

前端 未结 3 1731
半阙折子戏
半阙折子戏 2021-01-24 07:37

In my WP8 application I need to download some json data every 5 minutes.
But in MSDN it\'s written that periodic tasks are run every 30 minutes.

Are there any wor

相关标签:
3条回答
  • 2021-01-24 08:09

    I think this might be do your work.try this.

    dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
    dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
    dispatcherTimer.Interval = new TimeSpan(0,5,0);
    dispatcherTimer.Start();
    

    And DispatcherTimer_Tick Method

    private void dispatcherTimer_Tick(object sender, EventArgs e)
    {
          //Do your Method...
    }
    

    Go to MSDN Dispatcher Timer for more Details.

    0 讨论(0)
  • 2021-01-24 08:11

    You can use push Notification, or rawnotification dependent on how much data is needed to be send. And when the app is in foreground you can accomplish what you want with a timer? But using background tasks is not possible.

    Toast Notifications

    Server Side

    0 讨论(0)
  • 2021-01-24 08:19

    Sorry, you can't run a true background task more frequently than the standard intervals. You can, however, get the data as often as you like when the app is running in the foreground, but be aware that you might upset your users if there's a lot of data to pull.

    0 讨论(0)
提交回复
热议问题