protected override void OnBackgroundActivated(BackgroundActivatedEventArgs args) { try { var deferral = args.TaskInstance.GetDeferral(); // Figure out which background task this was switch (args.TaskInstance.Task.Name) { case ToastHelper.TOAST_ACTION_BACKGROUND_TASK: ToastHelper.HandleToastActionBackgroundActivation((ToastNotificationActionTriggerDetail)args.TaskInstance.TriggerDetails); break; case ToastHelper.TOAST_TIME_TRIGGER_BACKGROUND_TASK: ToastHelper.HandleTimeTriggerBackgroundActivation(); break; } deferral.Complete(); } catch { // Report to your telemetry } }