API reference

GroupPresence Class

Modifiers: final
The Group Presence API currently supports immersive apps and is designed to update the platform with a user's current Destination.apiName and status, including whether they are GroupPresenceOptions.isJoinable, their GroupPresenceOptions.lobbySessionId, and GroupPresenceOptions.matchSessionId. This allows a user's location to be displayed both in VR and outside of it on social platforms, and highlights popular destinations in your app. "Joinable" indicates that a user is in an area of your app that supports other users interacting with them. Note These APIs are currently supported only for immersive mode. For non-immersive apps, such as regular Android-based panel apps or 2D experiences, this functionality is not yet supported.

Signature

class GroupPresence

Constructors

GroupPresence ()
Signature
constructor()
Returns
GroupPresence

Methods

clear ()
Clears the current group presence settings for your app. Use this when a user's group presence setting in your app needs to be changed when moving to new destinations in your app.
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
suspend fun clear()
getDestinations ( coroutineScope )
Gets all the Destination that the presence can be set to
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
fun getDestinations(coroutineScope: CoroutineScope): PagedResults<Destination>
Parameters
coroutineScope: CoroutineScope
Returns
PagedResults  A list of Destination objects.
getInvitableUsers ( coroutineScope , options )
Returns a list of users that can be invited to your current lobby. These are pulled from your bidirectional followers and recently met lists.
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
fun getInvitableUsers(coroutineScope: CoroutineScope, options: InviteOptions): PagedResults<User>
Parameters
coroutineScope: CoroutineScope
options: InviteOptions  It contains two methods. 1. horizon.platform.group_presence.options.InviteOptions.suggested_user.add - Takes the userID as a parameter and adds it to the invitable users list. 2. horizon.platform.group_presence.options.SuggestedUsersOptions.clear - Clears the invitable users list.
Returns
PagedResults  List of users that can be invited to your current lobby.
getSentInvites ( coroutineScope )
Get the application invites which have been sent by the user.
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
fun getSentInvites(coroutineScope: CoroutineScope): PagedResults<ApplicationInvite>
Parameters
coroutineScope: CoroutineScope
Returns
PagedResults  List of application invites.
invitationsSent ()
Sent when the user is finished using the invite panel to send out invitations. Contains a list of invitees. Parameter: Callback is a function that will be called when the invitation sent status changes. LaunchInvitePanelFlowResult has 1 member: UserList LaunchInvitePanelFlowResult.invitedUsers
  • A list of users that were sent an invitation to the session.
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
fun invitationsSent(): Flow<LaunchInvitePanelFlowResult>
Returns
Flow<LaunchInvitePanelFlowResult>  The result of the invite panel launch.
joinIntentReceived ()
Sent when a user has chosen to join the destination/lobby/match. Read all the fields to figure out where the user wants to go and take the appropriate actions to bring them there. If the user is unable to go there, provide adequate messaging to the user on why they cannot go there. These notifications should be responded to immediately. Parameter: Callback is a function that will be called when a user has chosen to join the destination/lobby/match. GroupPresenceJoinIntent has 4 members: string GroupPresenceJoinIntent.deeplinkMessage
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
fun joinIntentReceived(): Flow<GroupPresenceJoinIntent>
Returns
Flow<GroupPresenceJoinIntent>  The result of the invite panel launch.
launchInvitePanel ( options )
Launches the system invite dialog with a roster of eligible users for the current user to invite to the app. It is recommended that you surface a button in your UI that triggers this dialog when a user is joinable.
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
suspend fun launchInvitePanel(options: InviteOptions): InvitePanelResultInfo
Parameters
options: InviteOptions  It contains two methods. 1. horizon.platform.group_presence.options.InviteOptions.suggested_user.add - Takes the userID as a parameter and adds it to the invitable users list. 2. horizon.platform.group_presence.options.SuggestedUsersOptions.clear - Clears the invitable users list.
Returns
InvitePanelResultInfo  The result of the invite panel launch.
launchMultiplayerErrorDialog ( options )
Launch an error dialog window with predefined messages for commonly occurring multiplayer errors. Check the Invokable Error Dialogs documentation for more information about these error messages and their values.
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
suspend fun launchMultiplayerErrorDialog(options: MultiplayerErrorOptions)
Parameters
options: MultiplayerErrorOptions  It contains a horizon.platform.group_presence.options.MultiplayerErrorOptions.error_key associated with the predefined error message to be shown to users.
launchRejoinDialog ( lobbySessionId , matchSessionId , destinationApiName )
Launch the dialog allowing users to rejoin a previous lobby or match. Either the user's GroupPresenceOptions.lobbySessionId, their GroupPresenceOptions.matchSessionId, or both must be populated as valid rejoinable destinations. Check the Rejoin documentation for use cases and information on this feature.
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
suspend fun launchRejoinDialog(lobbySessionId: String, matchSessionId: String, destinationApiName: String): RejoinDialogResult
Parameters
lobbySessionId: String
matchSessionId: String
destinationApiName: String
Returns
RejoinDialogResult  The result of the rejoin dialog launch.
launchRosterPanel ( options )
Launch the panel displaying the current users in the roster. We do not recommend using this API because the list current users is surfaced in the Destination UI when the Meta Quest button is pressed.
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
suspend fun launchRosterPanel(options: RosterOptions)
Parameters
options: RosterOptions  It contains 2 methods. 1. horizon.platform.group_presence.options.RosterOptions.suggested_user.add - it takes userID as a parameter and adds it to the invitable users list. 2. horizon.platform.group_presence.options.SuggestedUsersOptions.clear - it clears the invitable users list.
sendInvites ( userIds )
Sends invites to the current application to the list of userIDs passed in. You can fetch a list of users to pass in via the GroupPresence.getInvitableUsers. This API works as an alternative to GroupPresence.launchInvitePanel which delegates the invite flow to the system invite module. GroupPresence.launchInvitePanel is the recommended approach.
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
suspend fun sendInvites(userIds: List<String>): SendInvitesResult
Parameters
userIds: List
Returns
SendInvitesResult  The result of the invite send.
set ( groupPresenceOptions )
Sets group presence information for your current app. It is recommended that you use this parameter and its methods to set group presence information for your app. An example of using this parameter can be found on the Group Presence overview page where the methods to set GroupPresenceOptions.destinationApiName, GroupPresenceOptions.matchSessionId, and GroupPresenceOptions.lobbySessionId are used.
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
suspend fun set(groupPresenceOptions: GroupPresenceOptions)
Parameters
groupPresenceOptions: GroupPresenceOptions
setDeeplinkMessageOverride ( deeplinkMessage )
Sets the user's GroupPresenceOptions.deeplinkMessageOverride while keeping the other group presence parameters the same. If the destination of the user is not set, the deeplink message cannot be set as there's no deeplink message to override. This method does not power travel from the Meta Quest platform to your app. You must set a user's GroupPresenceOptions.destinationApiName, GroupPresenceOptions.isJoinable status, and GroupPresenceOptions.lobbySessionId to enable travel to your app. Check Group Presence overview for more information about these values. Note: Instead of using this standalone API, we recommend setting all GroupPresence parameters in one call to GroupPresence.set.
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
suspend fun setDeeplinkMessageOverride(deeplinkMessage: String)
Parameters
deeplinkMessage: String
setDestination ( apiName )
Replaces the user's current GroupPresenceOptions.destinationApiName with the provided one. Use this to set a user's current destination while keeping all the other Group Presence parameters the same. Setting a user's destination is required to enable travel from the Meta Quest Platform to your app. NOTE instead of using the standalone API, we recommend setting all GroupPresence parameters in one call to GroupPresence.set. This helps ensure that all relevant presence information is singularly updated and helps reduce presence errors.
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
suspend fun setDestination(apiName: String)
Parameters
apiName: String
setIsJoinable ( isJoinable )
Sets a user's current presence as joinable. Use this method to update a user's joinability as it changes. For example, when the game starts, the lobby becomes full, the user moves to a private, non joinable instance while keeping all other GroupPresence parameters (i.e GroupPresenceOptions.destinationApiName, GroupPresenceOptions.lobbySessionId, GroupPresenceOptions.matchSessionId) the same. Setting a user's destination is required to enable travel from the Meta Quest Platform to your app. Note: Instead of using this individual API, we recommend setting all GroupPresence information with the GroupPresence.set method and its associated parameters to simply managing all presence information. This helps ensure that all relevant presence information is singularly updated and helps reduce presence errors.
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
suspend fun setIsJoinable(isJoinable: Boolean)
Parameters
isJoinable: Boolean
setLobbySession ( id )
Replaces the user's current GroupPresenceOptions.lobbySessionId for the provided string. Use this to set a user's current lobby session id while keeping all other GroupPresence parameters the same. Setting a user's lobby session id is required to enable travel from the Meta Quest Platform to your app. Check Group presence overview for more information. NOTE instead of using the standalone API, we recommend setting all GroupPresence parameters in one call to GroupPresence.set. This helps ensure that all relevant presence information is singularly updated and helps reduce presence errors.
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
suspend fun setLobbySession(id: String)
Parameters
id: String  id is the unique identifier of the lobby session to set, replacing the user's current horizon.platform.group_presence.options.GroupPresenceOptions.lobby_session_id.
setMatchSession ( id )
Replaces the user's current GroupPresenceOptions.matchSessionId for the provided one. Use this to update the user's current match session id while keeping all other GroupPresence parameters the same. GroupPresenceOptions.matchSessionId works in conjuction with GroupPresenceOptions.lobbySessionId to determine if users are playing together. If a user's match and lobby session ids are the same, they should be in the same multiplayer instance together. Users with the same lobby session id but different match session ids may be in the same lobby for things like voice chat while in different instances in your app. WARNING match session id is often treated the same as lobby session id, but this is in fact a distinct parameter and is not used for travel from the Meta Quest Platform. NOTE instead of using the standalone API, we recommend setting all GroupPresence parameters in one call to GroupPresence.set.
This method can return the following status codes: common status codes in GroupPresenceStatusCode.
Signature
suspend fun setMatchSession(id: String)
Parameters
id: String  id is the unique identifier of the match session to set, replacing the user's current horizon.platform.group_presence.options.GroupPresenceOptions.match_session_id.