Skip to main content

Callback for the friend module (FriendResultObserver)

If you are using the Unity engine, see Unity SDK's FriendResultObserver.

Register the callback for the Player Network SDK friend module; the game needs to handle callback functionality.For more information on callback data structure, see FriendResult.

note

It is strongly recommended that games register during the application start-up function.

Function definition

C++ Event Handling Method (Above V1.15)

// Configure callback
void SetFriendResultObserver(FINTLFriendEvent& callback);
// Retrieve callback
FINTLFriendEvent& GetFriendResultObserver();

Unreal Engine Event Handling

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

Code example

C++ Event Handling Method (Above V1.15)

// Configure callback
FINTLFriendEvent friendEvent;
friendEvent.AddUObject(this, &OnFriendResult_Implementation);
UINTLSDKAPI::SetFriendResultObserver(friendEvent);
// Clear callback
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);
}