I have the same problem as this guy over here: UWP Timetrigger not working but I can't comment the question because my reputation is not high enough, so I'm creating a new question.
As I said, I have the same problem. I registered the background task, but nothing happens. My background task is located in a seperate project (Runtime Component). So that's not the problem. This is the method I made to register the task:
public static BackgroundTaskRegistration Register(string name, string taskEntryPoint, IBackgroundTrigger trigger, IBackgroundCondition condition)
{
var foundTask = BackgroundTaskRegistration.AllTasks.FirstOrDefault(x => x.Value.Name == name);
if (foundTask.Value != null)
return (BackgroundTaskRegistration)foundTask.Value;
var builder = new BackgroundTaskBuilder();
builder.Name = name;
builder.TaskEntryPoint = taskEntryPoint;
builder.SetTrigger(trigger);
if (condition != null)
builder.AddCondition(condition);
return builder.Register();
}
and this is how I call it:
BackgroundTaskRegister.Register(nameof(NotificationTask), $"Epguides.Background.{_backgroundTaskName}", new TimeTrigger(30, true), null);
When I debug my application and use Lifecycle Events in Visual studio to test my background task, everything works fine. So the problem is not the task.
When I inspect the BackgroundTaskRegistration result I see that the property trigger is null. on the MSDN page of BackgroundTaskRegistration.Trigger it says the following
This is not intended for use in your code. For all unsupported trigger types, the value returned by this property is null.
So from what I understand is that TimeTrigger is an unsupported trigger type, because Trigger is null.
This is what is declared in the manifest file
Is there someone that can explain why it is not working. I'm using version 10.0.10586