StreamSocket.EnableTransferOwnership Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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. |
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
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 |
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
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 |