Skip to main content

FriendResultObserver

If you were looking for the method for use with Unity, see FriendResultObserver for Unity SDK.

Register the callback of the Player Network SDK friend module, the game needs to process the callback function. For more information on the callback data structure, see FriendResult.

note

It is strongly recommended to perform registration in the startup function of the game application.

Function definition

C++ event handling (above V1.15)

//configure callback
void SetFriendResultObserver(FINTLFriendEvent& callback);
//get callback
FINTLFriendEvent& GetFriendResultObserver();

Unreal Engine event handling

UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "INTLSDKObserver")
void OnFriendResult(FINTLFriendResult ret);
virtual void OnFriendResult_Implementation(FINTLFriendResult ret) {};

Code sample

C++ event handling (above V1.15)

//configure callback
FINTLFriendEvent friendEvent;
friendEvent.AddUObject(this, &OnFriendResult_Implementation);
UINTLSDKAPI::SetFriendResultObserver(friendEvent);
// Remove callbacks
UINTLSDKAPI::GetFriendResultObserver().Clear();
void OnFriendResult_Implementation(FINTLFriendResult ret)
{
UE_LOG(LogTemp, Warning, TEXT("MethodID: %d"), ret.MethodId);
}

Unreal Engine event handling

void OnFriendResult_Implementation(FINTLFriendResult ret)
{
UE_LOG(LogTemp, Warning, TEXT("MethodID: %d"), ret.MethodId);
}