Hybrid App Setup - Unreal SDK (v4)

    Notice

    Before setting up your hybrid app, install the Unreal SDK and Web SDK on your app and website, respectively.

    You can set the Unreal SDK to handle Airbridge related tasks occurring on the in-app website in hybrid apps without changing the website code.

    Manage Web SDK Commands with the Unreal SDK

    Unreal SDK can handle commands related to event transmission, device settings, and user settings that take place in the Web SDK. Set up using FAirbridge::CreateWebInterfaceScript and FAirbridge::HandleWebInterfaceCommand functions before displaying the website in the web view.

    WebToken is a Web SDK token. The Web SDK token can be checked in Airbridge dashboard under [Settings]>[Tokens].

    PostMessageScript is a JavaScript code that delivers the payload variable, which stores the command passed from the web SDK to the Unreal SDK, to the Unreal area.

    Command is the command received from the web SDK delivered to the Unreal SDK.

    1234567891011121314151617
    void UWebViewClass::OnLoadStarted()
    {
        FString PostMessageScript = FAirbridge::CreateWebInterfaceScript(
            TEXT("YOUR_WEB_SDK_TOKEN"),
            [](const FString& Msg) -> FString
            {
                return TEXT("...");
            }("payload")
        );
    
        UWebViewClass->ExecuteJavascript(PostMessageScript);
    }
    
    void UWebViewClass::OnMessageReceived(const FString& Command)
    {
        FAirbridge::HandleWebInterfaceCommand(Command);
    }

    Attention

    Beware following.

    Was this page helpful?

    Have any questions or suggestions?