Hybrid App Setup - Unreal SDK

    Notice

    Before proceeding with the hybrid app setup, install the Unreal SDK and Web SDK.

    You can configure the Airbridge Unity SDK to handle Airbridge-related tasks occurring within the in-app website of a hybrid app without modifying the website's code.

    Handle Web SDK Commands with the Unreal SDK

    The Unreal SDK can handle commands related to event transmission, device settings, and user settings that occur within the Web SDK. Before displaying the website in the web view, configure the Unreal SDK using the FAirbridge::CreateWebInterfaceScript and FAirbridge::HandleWebInterfaceCommand functions.

    • webToken: This is the Web SDK token. Your Web SDK token can be found on the [Settings]>[Tokens] page in the Airbridge dashboard.

    • postMessageScript: This JavaScript code transmits the payload variable, which stores the command passed from the Web SDK to the Unreal SDK to the Unity area.

    • command: This command is passed from the Web SDK 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

    このページは役に立ちましたか?

    ご質問やご提案はありますか?