0
votes

As it's said at MSDN:

Windows has a built-in timer that runs background tasks in 15-minute intervals.

Let's assume that we make use a TimeTrigger with some freshness time. The Task will be scheduled with the nearst build-in timer tick - depending on the time when we register our Task, the time left to scheduling can vary.

Is it possible to get the time when our Task will be scheduled?

1
Out of curiosity, may I ask why do you want to do that? I don't think it's possible, but I can't say for sure.yasen
@yasen For example I plan to set a one-shot TimeTrigger and it would be suitable to inform the User about the exact time. Without knowing the exact time one-shot Task seems to be a little random feature.Romasz

1 Answers

0
votes

One solution which comes to my mind is to make another simple BackgroundTask with TimeTrigger set to one-shot and minimum freshnes stime. The job of this Task would be to save in LocalSettings the DateTime.Now to a variable.

As the build-in timer runs in constant intervals then I will be able to count the time of the next nearest run.

The disavantage of this solution is that after the OS restart I will have to update the variable. So it means that just after starting my App I would have to run this additional task to ensure about the correct value.

It means that I will be able to set the TimeTrigger more accurately after the first tick of buil-in timer.