Skip to main content

WebViewResultObserver

If you were looking for the method for use with Unreal Engine, see WebViewResultObserver for Unreal Engine SDK.

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

note

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

Function definition

// Add the INTLWebViewResult callback to process callback
public static void AddWebViewResultObserver(OnINTLResultHandler<INTLWebViewResult> callback);
// Remove the INTLWebViewResult callback
public static void RemoveWebViewResultObserver(OnINTLResultHandler<INTLWebViewResult> callback);

Code sample

// Add callbacks
public void AddWebViewObserver()
{
INTLAPI.AddWebViewResultObserver(OnWebViewRetEvent);
}

// Remove callbacks
public void RemoveWebViewObserver()
{
INTLAPI.RemoveWebViewResultObserver(OnWebViewRetEvent);
}

// Process the INTLWebViewResult callback
public void OnWebViewRetEvent(INTLWebViewResult ret)
{
Debug.Log($"MethodID: {ret.MethodId}");
}