Skip to main content

Callback for LBS module (LBSIPInfoResultObserver)

If you are using the Unity engine, please refer to Unity SDK's LBSIPInfoResultObserver.

Register the callback for the Player Network SDK LBS module; the game needs to register a callback to process it.For more information about the callback data structure, please refer to LBSIPInfoResult.

note

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

caution
  • Due to factors of the data source, conversion between IP and regions is not 100% accurate.
  • Due to network jitter or other factors, this API may not return results.It is not recommended to use it in critical game logic.Users must also consider default adaptation strategies in case of failure.
  • The conversion relationship between IP and regions will change by default with updates in the IP library data. If business requires a fixed conversion relationship, the Player Network assistant can be contacted for separate configuration.

Function definition

C++ Event Handling Method (V1.15 and above)

//Configure the callback
void SetLBSIPInfoResultObserver(FINTLLBSIPInfoEvent& callback);
//Get the callback
FINTLLBSIPInfoEvent& GetLBSIPInfoResultObserver();

Unreal Engine Event Handling Method

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

Code sample

C++ Event Handling Method (V1.15 and above)

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

Unreal Engine Event Handling Method

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