/** * Setting the group presence */ void SetPresence() { var options = new GroupPresenceOptions(); options.SetDestinationApiName(DestinationAPINames[DestinationIndex]); if (!string.IsNullOrEmpty(MatchSessionID)) { options.SetMatchSessionId(MatchSessionID); } if (!string.IsNullOrEmpty(MatchSessionID)) { options.SetLobbySessionId(LobbySessionID); } // Set is Joinable to let other players deeplink and join this user via the presence options.SetIsJoinable(IsJoinable); UpdateConsole("Setting Group Presence to " + DestinationAPINames[DestinationIndex] + " ..."); // Here we are setting the group presence then fetching it after we successfully set it GroupPresence.Set(options).OnComplete(message => { if (message.IsError) { UpdateConsole(message.GetError().Message); } else { // Note that Users.GetLoggedInUser() does not do a server fetch and will // not get an updated presence status Users.Get(LoggedInUserID).OnComplete(message2 => { if (message2.IsError) { UpdateConsole("Success! But presence is unknown!"); } else { UpdateConsole("Group Presence set to:\n" + message2.Data.Presence + "\n" + message2.Data.PresenceDeeplinkMessage + "\n" + message2.Data.PresenceDestinationApiName); } }); } }); }
// User has interacted with a deeplink outside this app void OnJoinIntentChangeNotif(Message <Oculus.Platform.Models.GroupPresenceJoinIntent> message) { if (message.IsError) { UpdateConsole(message.GetError().Message); } else { var joinIntent = message.Data; // The deeplink message, this should give enough info on how to go the // destination in the app. var deeplinkMessage = joinIntent.DeeplinkMessage; // The API Name of the destination. You can set the user to this after // navigating to the app var destinationApiName = joinIntent.DestinationApiName; var matchSessionID = joinIntent.MatchSessionId; var lobbySessionID = joinIntent.LobbySessionId; var detailsString = "-Deeplink Message:\n" + deeplinkMessage + "\n-Api Name:\n" + destinationApiName + "\n-Lobby Session Id:\n" + lobbySessionID + "\n-Match Session Id:\n" + matchSessionID; detailsString += "\n"; UpdateConsole("Got updated Join Intent & setting the user's presence:\n" + detailsString); var options = new GroupPresenceOptions(); if (!string.IsNullOrEmpty(destinationApiName)) { options.SetDestinationApiName(destinationApiName); } if (!string.IsNullOrEmpty(matchSessionID)) { options.SetMatchSessionId(matchSessionID); } if (!string.IsNullOrEmpty(lobbySessionID)) { options.SetLobbySessionId(lobbySessionID); } GroupPresence.Set(options); } }