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.
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.
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);
}
Beware following.
Make sure to collect the events that occur in the in-app WebView through the Web SDK in a hybrid app setting. When collecting such events through the App SDK, event duplication will occur.
Was this page helpful?