Calling web content
Web content calling is a feature that allows you to view web content directly from games by invoking in-game browsers, web views, or external browsers.
Users can view web content by invoking in-game browsers or web views suited to each game environment without leaving the game. Additionally, games can flexibly utilize various web content, enhancing the user experience.
Web content calling can be implemented with the following interfaces depending on the game environment:
Note
For more details on 'opening browsers within games', refer to Android Custom tabs and iOS SFSafariViewController documentation.
Open with in-game browser¶
Call external web content through an in-game browser without opening a separate browser.
Note
'Open with in-game browser' is currently supported only in mobile game environments.
Configuration features¶
'Open with in-game browser' is implemented using the 'InAppBrowserParam` parameter.
InAppBrowserParam parameter features and default settings are as follows:
| Feature | Description | Default value |
| NavigationColor | Specifies the color of the top navigation area. | OS default color |
| ButtonColor (iOS only) | Specifies the color of buttons in the top navigation area. | OS default color |
| UrlBarHiding | Hides the top URL display area when scroll events occur. | true |
| AutoRedirectToExternalBrowser (Android only) | Automatically supports external browser connection when the device's default browser app is not supported. | true |
Example code¶
InAppBrowserParam example code for 'implementing open with in-game browser' is as follows:
using hive;
InAppBrowserParam param = new InAppBrowserParam.Builder("https://developers.withhive.com/")
.setNavigationColor("#3891f0")
.setButtonColor("#ffffff")
.setUrlBarHiding(true)
.setAutoRedirectToExternalBrowser(true)
.build();
PlatformHelper.showInAppBrowser(param, (ResultAPI result) => {
if (result.isSuccess()) {
// API 호출 성공
}
});
#include "HivePlatformHelper.h"
FString URL = TEXT("https://developers.withhive.com/");
FHiveInAppBrowserParam Param(URL);
Param.NavigationColor = TEXT("3891f0");
Param.ButtonColor = TEXT("#FFFFFF");
Param.UrlBarHiding = true;
Param.AutoRedirectToExternalBrowser = true;
FHivePlatformHelper::ShowInAppBrowser(Param, FHivePlatformHelperOnShowInAppBrowserDelegate::CreateLambda([this](const FHiveResultAPI& Result) {
if (Result.IsSuccess()) {
// API 호출 성공
}
}));
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
InAppBrowserParam *param = new InAppBrowserParam("https://developers.withhive.com/");
param->navigationColor = "3891f0";
param->buttonColor = "#ffffff";
param->urlBarHiding = true;
param->autoRedirectToExternalBrowser = true;
PlatformHelper::showInAppBrowser(*param, [=](ResultAPI const & result) {
if (result.isSuccess()) {
// API 호출 성공
}
});
import com.hive.PlatformHelper;
import com.hive.ResultAPI;
PlatformHelper.InAppBrowserParam param = new PlatformHelper.InAppBrowserParam.Builder("https://developers.withhive.com/")
.setNavigationColor("#3891f0")
.setUrlBarHiding(true)
.setAutoRedirectToExternalBrowser(true)
.build();
PlatformHelper.showInAppBrowser(param, result -> {
if (result.isSuccess()) {
// API call successful
});
import com.hive.PlatformHelper;
import com.hive.ResultAPI;
val param = PlatformHelper.InAppBrowserParam.Builder("https://developers.withhive.com/")
.setNavigationColor("#3891f0")
.setUrlBarHiding(true)
.setAutoRedirectToExternalBrowser(true)
.build()
PlatformHelper.showInAppBrowser(param, object : PlatformHelper.InAppBrowserListener {
override fun onInAppBrowser(result: ResultAPI) {
if (result.isSuccess) {
// API 호출 성공
}
}
})
import HIVEService
let inAppBrowserParam = InAppBrowserParam.Builder(url: "https://developers.withhive.com/")
.setNavigationColor("#3891f0")
.setButtonColor("#ffffff")
.setUrlBarHiding(true)
.setAutoRedirectToExternalBrowserbuild(true)
.build()
PlatformHelperInterface.showInAppBrowser(inAppBrowserParam) { resultAPI in
if result.isSuccess() {
// API 호출 성공
}
};
#import <HIVEService/HIVEService-Swift.h>
HiveInAppBrowserParamBuilder *builder = [[HiveInAppBrowserParamBuilder alloc] initWithUrl: @"https://developers.withhive.com/"];
HiveInAppBrowserParam *inAppBrowserParam = [[[[[builder setNavigationColor: @"#3891f0"]
setButtonColor: @"#ffffff"]
setUrlBarHiding: @YES]
setAutoRedirectToExternalBrowser: @YES]
build];
[HIVEPlatformHelper showInAppBrowser: inAppBrowserParam handler: ^(HIVEResultAPI *result) {
if ([result isSuccess]) {
// API 호출 성공
}
}];
Open with in-game webview¶
Call web content by opening a webview in the game.
### Configuration features
'Open with in-game webview' is implemented using the InAppWebViewParam parameter. The useUserSession parameter provided by the InAppWebViewParam object can send in-app login session to the webview, and postData can send additional information desired by app developers.
InAppWebViewParam parameter features, default settings, and requirements are as follows:
| Feature | Description | Default value | Required |
|---|---|---|---|
| postData | Data containing additional information to be sent by app developers. Used when there is additional information to be displayed in the webview. | null | X |
| useUserSession | Includes login session information. Includes player_id and player_token in JSON format postData. | false | X |
| useGameWindow | Android-only feature that displays WebView in the current window. Not paused, and HiveTheme and HiveOrientation settings are ignored. | false | X |
Warning
When using useUserSession, postData must be in JSON format.
Example code¶
InAppWebViewParam example code for 'open with webview' is as follows:
#include "HivePlatformHelper.h"
FString URL = TEXT("https://developers.withhive.com/");
FHiveInAppWebViewParam Param(URL);
Param.UseUserSession = true;
Param.UseGameWindow = true;
FHivePlatformHelper::ShowInAppWebView(Param, FHivePlatformHelperOnShowInAppWebViewDelegate::CreateLambda([this](const FHiveResultAPI& Result) {
if (Result.IsSuccess()) {
// API call successful
}
}));
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
InAppWebViewParam *param = new InAppWebViewParam("https://developers.withhive.com/");
param->useUserSession = true;
param->useGameWindow = true;
PlatformHelper::showInAppWebView(*param, [=](ResultAPI const & result) {
if (result.isSuccess()) {
// API call successful
}
});
import com.hive.PlatformHelper;
import com.hive.ResultAPI;
PlatformHelper.InAppWebViewParam param = new PlatformHelper.InAppWebViewParam.Builder("https://developers.withhive.com/")
.setUseUserSession(true)
.setUseGameWindow(true)
.build();
PlatformHelper.showInAppWebView(param, result -> {
if (result.isSuccess()) {
// API call successful
}
});
import com.hive.PlatformHelper;
import com.hive.ResultAPI;
val param = PlatformHelper.InAppWebViewParam.Builder("https://developers.withhive.com/")
.setUseUserSession(true)
.setUseGameWindow(true)
.build()
PlatformHelper.showInAppWebView(param, object : PlatformHelper.InAppWebViewListener {
override fun onInAppWebView(result: ResultAPI) {
if (result.isSuccess) {
// API call successful
}
}
})
#import <HIVEService/HIVEService-Swift.h>
HiveInAppWebViewParamBuilder *builder = [[HiveInAppWebViewParamBuilder alloc] initWithUrl: @"https://developers.withhive.com/"];
HiveInAppWebViewParam *inAppWebViewParam = [[[builder setUseUserSession: @YES]
setUseGameWindow: @YES]
build];
[HIVEPlatformHelper showInAppWebView: inAppWebViewParam handler: ^(HIVEResultAPI *result) {
if ([result isSuccess]) {
// API call successful
}
}];
Open with external browser¶
Call web content by connecting a separate external browser from the game.
Note
'Open with external browser' is supported only in PC game environments and is provided from Hive SDK v4 Windows 25.1.0 and above.
Configuration features¶
OpenBrowserParam is used to call external browsers, and you can additionally set the useIncognitoMode option to use incognito mode.
'Open with external browser' is implemented using the OpenBrowserParam parameter. You can set incognito mode options with the useIncognitoMode parameter.
OpenBrowserParam parameter features and requirements are as follows:
| Feature | Description | Required |
|---|---|---|
| url | URL information to use for external browser calls | O |
| useIncognitoMode | * true: Call incognito mode browser * false: Call normal mode browser | O |
Example code¶
OpenBrowserParam example code for 'open with external browser' is as follows: