IBackgroundTaskInstance.Canceled IBackgroundTaskInstance.Canceled IBackgroundTaskInstance.Canceled IBackgroundTaskInstance.Canceled IBackgroundTaskInstance.Canceled Event

Definition

Attaches a cancellation event handler to the background task instance.

For Windows Phone 8.x app, if the device becomes low on memory, background tasks may be terminated without any warning and without raising the OnCanceled event. This helps to ensure the user experience of the app in the foreground. Your background task should be designed to handle this scenario.

public : event BackgroundTaskCanceledEventHandler Canceled
// Register
event_token Canceled(BackgroundTaskCanceledEventHandler const& handler) const;

// Revoke with event_token
void Canceled(event_token const& cookie) const;

// Revoke with event_revoker
Canceled_revoker Canceled(auto_revoke_t, BackgroundTaskCanceledEventHandler const& handler) const;
public event BackgroundTaskCanceledEventHandler Canceled
Public Event Canceled As BackgroundTaskCanceledEventHandler
function onCanceled(eventArgs){/* Your code */}


iBackgroundTaskInstance.addEventListener("canceled", onCanceled);
iBackgroundTaskInstance.removeEventListener("canceled", onCanceled);