CustomerResultObserver
Registers the Player Network SDK customer service module callback to receive customer service operation notifications. Currently, the callback is only triggered when the customer service UI is closed and the account is deleted. For more information on the callback data structure, see CustomerResult. For more information on WebView callbacks, see WebViewResultObserver.
note
It is strongly recommended to perform registration in the startup function of the game application.
Function definition
// Add the INTLCustomerResult callback to process callback
public static void AddCustomerResultObserver(OnINTLResultHandler<INTLCustomerResult> callback);
// Remove the INTLCustomerResult callback
public static void RemoveCustomerResultObserver(OnINTLResultHandler<INTLCustomerResult> callback);
Code sample
// Add callbacks
public void AddCustomerObserver()
{
INTLAPI.AddCustomerResultObserver(OnCustomerResultEvent);
INTLAPI.AddWebViewResultObserver(OnWebViewRetEvent);
}
// Remove callbacks
public void RemoveCustomerObserver()
{
INTLAPI.RemoveCustomerResultObserver(OnCustomerResultEvent);
INTLAPI.RemoveWebViewResultObserver(OnWebViewRetEvent);
}
// Process the INTLCustomerResult callback
public void OnCustomerResultEvent(INTLCustomerResult ret)
{
Debug.Log($"MethodID: {ret.MethodId}");
string methodTag = "";
if (customerRet.MethodId == (int)INTLMethodID.INTL_CUSTOMER_LAUNCH_UI)
{
methodTag = "LaunchCustomerUI";
}
if (customerRet.MsgType == 100) // 100 close UI
{
m_sample.ShowLogInNewLine(methodTag + ": close Customer Service UI.");
}
else
{
m_sample.ShowLogInNewLine("MsgType: " + customerRet.MsgType.ToString());
}
}
// INTLWebViewResult callback processing for account deletion
private void OnWebViewRetEvent(INTLWebViewResult webViewRet)
{
#if INTL_OS_WINDOWS
#else
if (webViewRet.MethodId == (int) INTLMethodID.INTL_WEBVIEW_JS_CALL)
{
// This is a non-unity process, be careful not to do unity-related operations
INTLLog.Log("before AddMessage in customer");
CustomerSample.AddMessage("WebViewRetEvent:" + Tools.Instance.GetRetString(webViewRet));
}
else
{
m_sample.ShowLogInNewLine("WebViewRetEvent:" + Tools.Instance.GetRetString(webViewRet));
}
#endif
}