Convert an out-of-process background task to an in-process background task

The simplest way to convert your out-of-process background activity into in-process activity is to bring your IBackgroundTask.Run method code inside your application and initiate it from OnBackgroundActivated.

If your app has multiple background tasks, the Background Activation Sample shows how you can use BackgroundActivatedEventArgs.TaskInstance.Task.Name to identify which task is being initiated.

If you are currently communicating between background and foreground processes, you can remove that state management and communication code.

Background tasks and trigger types that cannot be converted

  • In-process background tasks don't support activating a VoIP background task.
  • In-process background tasks don't support the following triggers: DeviceUseTrigger, DeviceServicingTrigger and IoTStartupTask