سؤال

I've a background task for my universal app with a TimeTrigger. It works fine, but the TimeTrigger class only has a freshnessTime for reoccuring tasks. I would prefer if the background task was executed once sometime at night. Is that possible somehow? I've search around as good as I can without finding anything, but perhaps I missed something. For now I'm setting freshnessTime to 720 (60*12) to have it execute twice a day:

var builder = new BackgroundTaskBuilder {Name = TASK_NAME, TaskEntryPoint = TASK_ENTRY};
builder.SetTrigger(new TimeTrigger(720, false)); 
var registration = builder.Register();
هل كانت مفيدة؟

المحلول

Seems that the best way to do this is to run the tasks the background is supposed to do (like updating a live tile) when your app is loaded/running and then do time-triggers twice per day as the code example in the question shows.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top