Reputation: 1145
I am trying to use background task with TimeTrigger. I do not provide entry point that leads to Application.OnBackgroundActivated be called on OS version 332 or higher.
I have two questions:
It seems there is no param in Application.OnBackgroundActivated to indicate it is called as a result of time trigger. Specifically in my app it is can be called for other triggers and use cases. I need some way to determine that it is time trigger activation.
TimeTrigger can only be set for 15 minutes minimum. Is there way for debugging purposes shorten this time?
Upvotes: 0
Views: 232
Reputation: 16652
For your first question, if your app has multiple background tasks, you can use BackgroundActivatedEventArgs.TaskInstance.Task.Name
to identify which task is being initiated. You can refer to the official Background activation sample to see how it works.
For your second question, yes there is way for debugging purposes shorten this time. You can find the Lifecycle Events
when debugging your app, after a TimeTrigger
is registered, you can see the following lifecircle event:
Just click this item, the TimeTriggerTask
will be fired immediately.
Upvotes: 1