Presence Backend Reference #
This section provides Presence service references for plugins, classes, exts, and configuration values defined in the Pragma Engine backend. For specifics on the using the Pragma SDK for Presence tasks, see Presence SDK Reference.
The Presence Plugin #
The Presence Plugin provides a location for developers to implement custom presence functionality, such as handling the rich presence ext
. The Presence Tasks topic shows example usage of the Presence Plugin methods, along with the SDKs that invoke them.
Presence class #
The Presence class represents a player’s status.
property | description |
---|---|
socialId | Unique social identifier for the player (game agnostic) |
playerId | Unique player ID |
gameShardId | Unique identifier of the game shard associated with this presence object |
gameTitleId | Title of the game associated with the gameShardId. See Game Title Management in the Portal documentation for more information of game shard/game title mapping. |
basicPresence | BasicPresence object representing whether the user appears “online” or “away”. See following table. |
ext | Custom ExtRichPresence payload containing custom data to display to friends |
Basic presence enum #
property | description |
---|---|
online | User’s presence status is “online” |
away | User’s presence status is “away” |
Presence API backend class #
The PresenceeApi.kt
backend class is the entrypoint to the Presence service from other backend services or plugins.
method | description |
---|---|
setRichPresence() | Requests a rich presence update (using ExtRichPresenceBackendRequest ) for a player |
getForPlayer() | Returns the presence value for a specific player, identified by social ID |
Extension data #
You can use Extension Data (exts
) to define custom data about player presence statuses. See Presence Tasks for sample implementation.
The following table lists the ext
payloads relevant to presence information.
ext | description | example data |
---|---|---|
ExtRichPresencePlayerRequest | Custom presence values set/updated by the player client | custom away message |
ExtRichPresenceBackendRequest | Custom presence values set/updated by the game server | current score |
Configuration #
The FriendsServiceConfig
configuration block provides a place to define default values for the Friend and Presence services.
The following configuration values are related to Presence features:
config | description |
---|---|
enablePresenceUpdates | Enable or disable ability to update presence statuses. If false , a player’s basic and rich presences cannot be updated. The Presence API’s GetPresence method is still available and will return presence values (if any) at the time enablePresenceUpdates was set to false .Default: true |
See Friend Reference for information on other configuration values.
Errors #
- Presence_GameIdentityNotFound
- Presence_PresenceNotFound