tl;dr: How do I register a Background Task without having to run the app?
Long version:
I want to register a Background Task to run every time the user logs in using SystemTriggerType.UserPresent
.
I've found information about registering the Task, but that is code that has to be executed. That would be fine if the Task only has to be executed after the app runs. But how do I register the Task without running the app? A Background Task can be registered by
var builder = new BackgroundTaskBuilder();
and then
builder.Name = taskName;
builder.TaskEntryPoint = taskEntryPoint;
builder.SetTrigger(trigger);
BackgroundTaskRegistration task = builder.Register();
As mentioned here: Register a background task .
But as I said - my question is how to run this code before the app has ever been executed.