Updating a user’s online Presence status
This example code sets a user’s online Presence status. The following example uses the flat C API.Updating Rich Presence status
The following example sets theplayingMap Rich Presence string for the user. In this example, playingMap is configured as a static string that has no tokens. xboxLiveContext is the XblContextHandle for the user, and queue is your game’s task queue, or nullptr to use the process default task queue.
presenceTokenIds to their configured string IDs in placeholder order, and set presenceTokenIdsCount to the array length.
If the scid or presenceId member is empty, the request includes only the active or inactive state and doesn’t include a Rich Presence string.
For more information, see the following:
Rate limits and certification
The Presence service allows each user and title 3 writes in 15 seconds and 30 writes in 300 seconds. Update Rich Presence when the player’s activity changes, and combine rapid changes into a single update. If you also refresh Rich Presence periodically, keep the combined rate within both limits. If a call fails withHTTP_E_STATUS_429_TOO_MANY_REQUESTS (XblErrorCondition::Http429TooManyRequests), don’t retry in a loop. The service response includes a Retry-After header, and XSAPI honors it.
Certification test XR-132 fails a title whose request rate is at or above 10 times the sustain limit, which is 300 Presence writes in 300 seconds. This threshold isn’t a safe operating allowance. For more information, see Fine-grained rate limiting.