Compartir a través de


XblMultiplayerActivitySetActivityAsync

Sets or updates the multiplayer activity for a local user.

Syntax

HRESULT XblMultiplayerActivitySetActivityAsync(  
         XblContextHandle xblContext,  
         const XblMultiplayerActivityInfo* activityInfo,  
         bool allowCrossPlatformJoin,  
         XAsyncBlock* async  
)  

Parameters

xblContext   _In_
Type: XblContextHandle

Xbox Live context for the local user.

activityInfo   _In_
Type: XblMultiplayerActivityInfo*

Information about the activity. The maxPlayers and currentPlayers fields are optional; they are ignored if set to 0. The value of the platform field is ignored; XSAPI automatically sets the activity on the appropriate local platform.

allowCrossPlatformJoin   _In_
Type: bool

True if the activity should be joinable on other platforms supported by the title.

async   _In_
Type: XAsyncBlock*

The XAsyncBlock for this operation.

Return value

Type: HRESULT

HRESULT return code for this API operation.

Remarks

When a title starts or joins a multiplayer experience, it should create an activity. Doing this lets both the shell and other players in your title see the player's activity. Your title can let other players join the game in progress. If a player wants to join an activity for your title and it is not running, it is activated and the connection string is passed to it.

To see how this function is used, see "Setting an activity" in the Activities section of Example code for Multiplayer Activity.

REST Call

Calls PUT /titles/{titleId}/users/{xuid}/activites

Requirements

Header: multiplayer_activity_c.h

Library: Microsoft.Xbox.Services.14x.GDK.C.lib

See also

multiplayer_activity_c