> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XblMultiplayerActivitySetActivityAsync

> XblMultiplayerActivitySetActivityAsync

# XblMultiplayerActivitySetActivityAsync

Sets or updates the multiplayer activity for a local user.

## Syntax

```cpp theme={null}
HRESULT XblMultiplayerActivitySetActivityAsync(  
         XblContextHandle xblContext,  
         const XblMultiplayerActivityInfo* activityInfo,  
         bool allowCrossPlatformJoin,  
         XAsyncBlock* async  
)  
```

### Parameters

*xblContext*   \_In\_\
Type: [XblContextHandle](/reference/live/xsapi-c/types_c/handles/xblcontexthandle)

XBOX Live context for the local user.

*activityInfo*   \_In\_\
Type: [XblMultiplayerActivityInfo\*](/reference/live/xsapi-c/multiplayer_activity_c/structs/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. <br /><br /> To see how this function is used, see "Setting an activity" in the [Activities](/services/xbox-services/multiplayer/mpa/how-to/live-mpa-client-how-to#activities) section of [Example code for Multiplayer Activity](/services/xbox-services/multiplayer/mpa/how-to/live-mpa-client-how-to).

## 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](/reference/live/xsapi-c/multiplayer_activity_c/multiplayer_activity_c_members)


## Related topics

- [XblMultiplayerActivityPlatform](/reference/live/xsapi-c/multiplayer_activity_c/enums/xblmultiplayeractivityplatform.md)
- [XblMultiplayerActivityInfo](/reference/live/xsapi-c/multiplayer_activity_c/structs/xblmultiplayeractivityinfo.md)
- [XblMultiplayerActivityJoinRestriction](/reference/live/xsapi-c/multiplayer_activity_c/enums/xblmultiplayeractivityjoinrestriction.md)
- [Example code for Multiplayer Activity](/services/xbox-services/multiplayer/mpa/how-to/live-mpa-client-how-to.md)
- [XGameUiShowMultiplayerActivityGameInviteAsync](/reference/system/xgameui/functions/xgameuishowmultiplayeractivitygameinviteasync.md)
