CallJS
[Player Network SDK & MSDK] The communication interface between JS code and Native code.
Supported Platform
- Unity
- Unreal Engine
Supports
Android, iOS, Windows platform.Supports
Android, iOS, Windows platform.note
MSDK currently does not support Windows.
Function Definition
- Unity
- Unreal Engine
void CallJS(string jsonJsParam);
static void CallJS(const std::string &json_js_params);
Input Parameters
- Unity
- Unreal Engine
| Parameter | Type | Description |
|---|---|---|
| jsonJsParam | string | JSON string |
| Parameter | Type | Description |
|---|---|---|
| json_js_params | std::string | JSON string |
Callback Processing
The callback processing API is GUAWebViewResultObserver. The callback data structure is GUAWebViewRet.
- Unity
- Unreal Engine
The callback event is WebViewRetEvents.
The callback methodID is GUA_WEBVIEW_JS_CALL.
The callback event is OnWebViewOptNotify.
The callback methodID is kMethodIDWebViewJsCall.
Code Sample
- Unity
- Unreal Engine
UnionAdapterAPI.GetWebViewService().CallJS("jsonJsParam");
GUA_NAMESPACE::GUAWebViewService::CallJS("jsonJsParam");