Skip to main content

LBSIPInfoResultObserver

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

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

note

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

caution
  • The conversion between IPs and regions is not at 100% accuracy due to data source factors.
  • The API may fail to return results due to network jitter or other factors. It is not recommended to use it in critical game logic. Users must also consider the default adaptation policy in case of failure.
  • The conversion relationship between IP and region will change by default with the update of data in the IP database. If a fixed conversion relationship between IP and region is needed, reach out to the Player Network representative.

Function definition

C++ event handling (above V1.15)

//configure callback
void SetLBSIPInfoResultObserver(FINTLLBSIPInfoEvent& callback);
//get callback
FINTLLBSIPInfoEvent& GetLBSIPInfoResultObserver();

Unreal Engine event handling

UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "INTLSDKObserver")
void OnIPInfoResult(FINTLLBSIPInfoResult ret);
virtual void OnIPInfoResult_Implementation(FINTLLBSIPInfoResult ret) {};

Code sample

C++ event handling (above V1.15)

//configure callback
FINTLLBSIPInfoEvent lBSIPInfoEvents;
lBSIPInfoEvents.AddUObject(this, &OnIPInfoResult_Implementation);
UINTLSDKAPI::SetLBSIPInfoResultObserver(lBSIPInfoEvents);
// Remove callbacks
UINTLSDKAPI::GetLBSIPInfoResultObserver().Clear();
void OnIPInfoResult_Implementation(FINTLLBSIPInfoResult ret)
{
UE_LOG(LogTemp, Warning, TEXT("MethodID: %d"), ret.MethodId);
}

Unreal Engine event handling

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