Share via


PushNotificationReceivedEventArgs.GetDeferral Method

Definition

Informs the system that the app might continue to perform work after the PushReceived event handler returns.

public:
 virtual BackgroundTaskDeferral ^ GetDeferral() = GetDeferral;
BackgroundTaskDeferral GetDeferral();
public BackgroundTaskDeferral GetDeferral();
function getDeferral()
Public Function GetDeferral () As BackgroundTaskDeferral

Returns

A background task deferral.

Remarks

If PushReceived event handler uses an asynchronous operation, it is possible for the handler to return before the background task has completed its work. As soon as the handler returns, the system might suspend or terminate the background task host process, which could prevent completion of asynchronous operations started by the background task.

To keep the host process from being suspended or terminated while the background task is running, use the GetDeferral method to get a background task deferral for each asynchronous operation initiated. Then, when the asynchronous operation is finished, call the BackgroundTaskDeferral.Complete method.

Applies to