Forum Discussion
Fredrum
7 years agoExpert Protege
Not getting expected status from Friend->GetPresence()
Hello,
we are not getting the result returned that we would have expected from a GetFriendStatus command that the programmer has made for Unreal.
This has been made into an unreal node that gets triggered manually for now for testing.
I have tested with both players running different online accounts on two computers simultaneously.
Both have got through the checks and are otherwise listed correctly from the same function, for example I get the correct friend names.
The ones I was expecting True from but are getting a False are:
(I didn't try Presence.bIsPlaying)
OculusFriend.bIsPlayingSameGame = Presence.bIsPlayingThisGame;
OculusFriend.bIsJoinable = Presence.bIsJoinable;Here's a larger snippet from the code:
// Now that we are sure that everything worked, try to actually get the FriendList
TArray<TSharedRef<FOnlineFriend>> FriendList;
FriendInterface->GetFriendsList(LocalUserNum, ListName, FriendList);
// Iterate over the FriendList and fill in all Data into our Dummy Struct
for (TSharedRef<FOnlineFriend> Friend : FriendList)
{
// Get Presence State
FOnlineUserPresence Presence = Friend->GetPresence();
// Dummy Array Entry
FOculusFriend OculusFriend;
OculusFriend.DisplayName = Friend->GetDisplayName();
OculusFriend.RealName = Friend->GetRealName();
OculusFriend.StatusString = Presence.Status.StatusStr;
OculusFriend.bIsOnline = Presence.bIsOnline;
OculusFriend.bIsPlaying = Presence.bIsPlaying;
OculusFriend.bIsPlayingSameGame = Presence.bIsPlayingThisGame;
OculusFriend.bIsJoinable = Presence.bIsJoinable;
OculusFriend.bHasVoiceSupport = Presence.bHasVoiceSupport;
OculusFriend.PresenceState = (EOnlinePresenceState::Type)(int32)Presence.Status.State;
OculusFriend.UniqueNetID = Friend->GetUserId();
OculusFriendList.Add(OculusFriend);
}Like I said, the
Friend->GetDisplayName();andPresence.bIsOnline;works so at least partially this is working.Is there anyone that knows what's up or can verify that this should be working?
Is there anything else in particular that I am expected to do to flip these to True?
Cheers
Fredrik
4 Replies
Replies have been turned off for this discussion
- eXifreXiExplorer(Person who implemented this)
Just to add some context. The code above uses Epic's FriendInterface, which can be implemented by each Subsystem.
Using it to retrieve the Friendlist works fine, so I assume you peeps actually implemented that part.
Now I know that most, if not all, of these variables work for Steam Subsystem, so it's not Epic's code that fails here.
I haven't looked into your Subsystem to see if you actually fill them, cause I sadly don't have the time for that.
Would be nice, if one of your SubsystemPlugin coders could check if this data can somehow be queried and set properly.
Kind regards,
Cedric Neukirchen
PS: Here is the full code of aboves snippet:
Code is placed in a simple 'UOnlineBlueprintCallProxyBase' child, which Epic uses to create async blueprint nodes.void UGetFriendListCallbackProxy::Activate()
{
if (PlayerControllerWeakPtr.IsValid())
{
IOnlineFriendsPtr FriendInterface = Online::GetFriendsInterface();
if (FriendInterface.IsValid())
{
const ULocalPlayer* LocalPlayer = PlayerControllerWeakPtr->GetLocalPlayer();
// Request the FriendList from the FriendInterface.
FriendInterface->ReadFriendsList(LocalPlayer->GetControllerId(), FriendListTypeToString(FriendListType), OnReadFriendsCompleteDelegate);
return;
}
}
TArray<FOculusFriend> FriendList;
OnFailure.Broadcast(FriendList);
}
// Called once the async call completes
void UGetFriendListCallbackProxy::OnGetFriendListComplete(int32 LocalUserNum, bool bWasSuccessful, const FString& ListName, const FString& ErrorStr)
{
TArray<FOculusFriend> OculusFriendList;
if (bWasSuccessful)
{
IOnlineFriendsPtr FriendInterface = Online::GetFriendsInterface();
if (FriendInterface.IsValid())
{
// Now that we are sure that everything worked, try to actually get the FriendList
TArray<TSharedRef<FOnlineFriend>> FriendList;
FriendInterface->GetFriendsList(LocalUserNum, ListName, FriendList);
// Iterate over the FriendList and fill in all Data into our Dummy Struct
for (TSharedRef<FOnlineFriend> Friend : FriendList)
{
// Get Presence State
FOnlineUserPresence Presence = Friend->GetPresence();
// Dummy Array Entry
FOculusFriend OculusFriend;
OculusFriend.DisplayName = Friend->GetDisplayName();
OculusFriend.RealName = Friend->GetRealName();
OculusFriend.StatusString = Presence.Status.StatusStr;
OculusFriend.bIsOnline = Presence.bIsOnline;
OculusFriend.bIsPlaying = Presence.bIsPlaying;
OculusFriend.bIsPlayingSameGame = Presence.bIsPlayingThisGame;
OculusFriend.bIsJoinable = Presence.bIsJoinable;
OculusFriend.bHasVoiceSupport = Presence.bHasVoiceSupport;
OculusFriend.PresenceState = (EOnlinePresenceState::Type)(int32)Presence.Status.State;
OculusFriend.UniqueNetID = Friend->GetUserId();
OculusFriendList.Add(OculusFriend);
}
OnSuccess.Broadcast(OculusFriendList);
return;
}
}
OnFailure.Broadcast(OculusFriendList);
}
You also used them before for your custom create and find session nodes. Rest of the class code isn't really relevant.
The 'FOculusFriend' struct is custom and used to exposed the data to Blueprints. - FredrumExpert ProtegeHi
Hi @imperativity,
is there any chance of getting someone from Oculus to confirm if this should be expected to work or not?
And if it is, what might it be that we have missed?
Cheers
Fredrik - eXifreXiExplorerTo speed this up a bit, here is what you guys are saving:
So you are filling in the Precense here:for (size_t FriendIndex = 0; FriendIndex < UserNum; ++FriendIndex)PresenceStatus, FriendInviteTokenString));
{
auto Friend = ovr_UserArray_GetElement(UserArray, FriendIndex);
auto FriendId = ovr_User_GetID(Friend);
auto FriendDisplayName = ovr_User_GetOculusID(Friend);
auto FriendPresenceStatus = ovr_User_GetPresenceStatus(Friend);
auto FriendInviteToken = ovr_User_GetInviteToken(Friend);
FString FriendInviteTokenString(UTF8_TO_TCHAR((FriendInviteToken != nullptr) ? FriendInviteToken : ""));
TSharedRef<FOnlineOculusFriend> OnlineFriend(new FOnlineOculusFriend(FriendId, FriendDisplayName, Friend
OutList.Add(FriendId, OnlineFriend);
}
While "ovr_User_GetPresenceStatus" only returns "Online" "Offline" and "Unknown" and sets "bIsOnline" like this in the Struct Constructor:auto FriendPresenceStatus = ovr_User_GetPresenceStatus(Friend);Presence.bIsOnline = FriendPresenceStatus == ovrUserPresenceStatus_Online;
So tl;dr, you peeps aren't setting any of the Presence struct data, despite the bIsOnline.
If there is more data existing, please let me know how to access it, then I add this myself. - FredrumExpert Protege
Thanks for getting the confirmation.
It helps knowing that it shouldn't be expected to work yet. (maybe this should be tagged in the documentation somewhere?)
Cheers, Fred
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 1 month ago