Share via


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.

[Windows.Foundation.Metadata.Overload("EnableTransferOwnershipWithConnectedStandbyAction")]
public void EnableTransferOwnership(Guid taskId, SocketActivityConnectedStandbyAction connectedStandbyAction);

Parameters

taskId
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

WinRT Build 26100 and other versions
Product Versions
WinRT Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100

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.

[Windows.Foundation.Metadata.Overload("EnableTransferOwnership")]
public void EnableTransferOwnership(Guid taskId);

Parameters

taskId
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

WinRT Build 26100 and other versions
Product Versions
WinRT Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100