2

I'm preparing for the new microsoft certification exam Universal Windows Platform – App Data, Services, and Coding Patterns

Is it possible to directly call background task from Windows 10 (Universal WIndows) app? As far as I know, only triggers like SystemTrigger or TimerTrigger can trigger the execution of background task

In the skill mesuread section from the link is:

Implement background tasks

Create a background task, register a background task, set and respond to triggers, debug a background task, implement a lock screen app, share data/events between an app and its background tasks; directly calling a background task

The last point, directly calling a background task, what does it mean?

Liero
  • 25,216
  • 29
  • 151
  • 297

1 Answers1

4

I think that would be the ApplicationTrigger class.

See here: https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.background.applicationtrigger.aspx

This is btw new in UWP. In A Windows (Phone) Store 8.1 app there was no way to trigger a background task directly from the app.

gregkalapos
  • 3,529
  • 2
  • 19
  • 35
  • Do I have to do something special in the package manifest declarations, because when I call RequestAsync I receive UnknownError enumeration. and I clear the Run method just for testing. – Juan Pablo Garcia Coello Dec 31 '15 at 08:34
  • Yes, you have to add "Background Tasks" under "Declarations" in the manifest in the app which uses the background task. See here: https://msdn.microsoft.com/en-us/library/windows/apps/mt299100.aspx?f=255&MSPPError=-2147217396 – gregkalapos Dec 31 '15 at 10:08
  • Yes, right, I have to use Audio and systemEvent Tasks, but it does not allow to have more than one active, it is a weird behavior – Juan Pablo Garcia Coello Dec 31 '15 at 10:10