Skip to main content

XblSocialAddFriendRequestCountChangedHandler

Registers an event handler for notifications of incoming friend requests for the registering user.

Syntax

Parameters

xboxLiveContext   _In_
Type: XblContextHandle
An XBOX services context handle created with XblContextCreateHandle. The handler receives notifications for the user associated with this context. handler   _In_
Type: XblSocialIncomingFriendRequestCountChangedHandler
The callback function that receives notifications. handlerContext   _In_opt_
Type: void*
Client context pointer to be passed back to the handler. handlerFunctionContext   _Out_
Type: XblFunctionContext*
Passes back a token that identifies the handler. Pass this token to XblSocialRemoveFriendRequestCountChangedHandler to remove the handler.

Return value

Type: HRESULT Returns S_OK if the handler was registered. Returns E_INVALIDARG if xboxLiveContext, handler, or handlerFunctionContext is null.

Remarks

The handler receives notifications when the number of pending incoming friend requests for the user changes. Each notification passes an XblSocialFriendRequestCountChangedEventArgs structure that contains the current count. You don’t need to subscribe to these notifications separately. When you register a handler, the XBOX Services API (XSAPI) creates a Real-Time Activity (RTA) subscription to social relationship notifications for the context’s user, or reuses the existing one. Friend request count handlers and social relationship changed handlers share this subscription. XSAPI removes the subscription only after you remove all handlers of both types for the context. If the handler throws a C++ exception, XSAPI catches and logs it. Call XblSocialRemoveFriendRequestCountChangedHandler to unregister the event handler.

Requirements

Header: social_c.h Library: Microsoft.Xbox.Services.142.C.lib or Microsoft.Xbox.Services.143.C.lib

See also

social_c
XblSocialIncomingFriendRequestCountChangedHandler
XblSocialRemoveFriendRequestCountChangedHandler
XblSocialAddSocialRelationshipChangedHandler
Last modified on October 29, 2026