Jaa


StreamSocket.EnableTransferOwnership Method

Definition

Overloads

EnableTransferOwnership(Guid, SocketActivityConnectedStandbyAction)

Enables or disables the ability of your app's background task to be triggered by the socket broker when traffic for this StreamSocket arrives while the system is in connected standby.

EnableTransferOwnership(Guid)

Enables your app's background task to be triggered by the socket broker when traffic for this StreamSocket arrives while the app is not active.

EnableTransferOwnership(Guid, SocketActivityConnectedStandbyAction)

Enables or disables the ability of your app's background task to be triggered by the socket broker when traffic for this StreamSocket arrives while the system is in connected standby.

public:
 virtual void EnableTransferOwnership(Platform::Guid taskId, SocketActivityConnectedStandbyAction connectedStandbyAction) = EnableTransferOwnership;
/// [Windows.Foundation.Metadata.Overload("EnableTransferOwnershipWithConnectedStandbyAction")]
void EnableTransferOwnership(winrt::guid const& taskId, SocketActivityConnectedStandbyAction const& connectedStandbyAction);
[Windows.Foundation.Metadata.Overload("EnableTransferOwnershipWithConnectedStandbyAction")]
public void EnableTransferOwnership(Guid taskId, SocketActivityConnectedStandbyAction connectedStandbyAction);
function enableTransferOwnership(taskId, connectedStandbyAction)
Public Sub EnableTransferOwnership (taskId As Guid, connectedStandbyAction As SocketActivityConnectedStandbyAction)

Parameters

taskId
Guid

Platform::Guid

winrt::guid

The IBackgroundTaskRegistration.TaskId of the background task being enabled or disabled.

connectedStandbyAction
SocketActivityConnectedStandbyAction

Specifies whether to enable or disable the activation of the background task when traffic arrives.

Attributes

Remarks

The most common cause of an exception with a code of 0x80070490 and a message of "Element not found" is that your system doesn't support connected standby. You can verify that by calling EnableTransferOwnership(taskId, SocketActivityConnectedStandbyAction.DoNotWake). If that alternate call succeeds without throwing an exception, then that confirms that the original exception is caused by the system not being set up for connected standby. And that's a condition that your code will need to handle.

The API calling pattern that we recommend is to call EnableTransferOwnership(taskId, SocketActivityConnectedStandbyAction.Wake). If you experience the exception described above, then re-try the call with SocketActivityConnectedStandbyAction.DoNotWake.

See also

Applies to

EnableTransferOwnership(Guid)

Enables your app's background task to be triggered by the socket broker when traffic for this StreamSocket arrives while the app is not active.

public:
 virtual void EnableTransferOwnership(Platform::Guid taskId) = EnableTransferOwnership;
/// [Windows.Foundation.Metadata.Overload("EnableTransferOwnership")]
void EnableTransferOwnership(winrt::guid const& taskId);
[Windows.Foundation.Metadata.Overload("EnableTransferOwnership")]
public void EnableTransferOwnership(Guid taskId);
function enableTransferOwnership(taskId)
Public Sub EnableTransferOwnership (taskId As Guid)

Parameters

taskId
Guid

Platform::Guid

winrt::guid

The IBackgroundTaskRegistration.TaskId of the background task that will be triggered by the socket broker when traffic arrives for this StreamSocket.

Attributes

Remarks

For info about error conditions, see the Remarks section for EnableTransferOwnership(Guid, SocketActivityConnectedStandbyAction).

See also

Applies to