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.
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.
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);
}
Note that with the hybrid app setup, events that occur in the in-app web view must be collected through the Web SDK only. If collected through the App SDK as well, event duplication will occur. If your in-app web view uses a live mobile website, utilize only the Web SDK for event collection.
このページは役に立ちましたか?