Calling web content
Web content calling is a feature that allows you to check web content directly in the game by calling the in-game browser and web view or an external browser.
Users can check web content by calling the in-game browser or web view according to each game environment without leaving the game. Moreover, it allows for flexible use of various web content in the game, enhancing the user experience.
Web content calls can be implemented with the following interface depending on the game environment.
Note
For more information on 'Opening the browser in the game', refer to the Android Custom tabs and iOS SFSafariViewController documentation.
Open in-game browser¶
Calls external content through the in-game browser without opening a separate browser.
Note
'Opening in in-game browser' is currently supported only in mobile game environments.
Settings functions¶
'Opening in-game browser' is implemented using the 'InAppBrowserParam' parameter.
InAppBrowserParam
parameters that can be set and their default values are as follows.
Feature | Content | Default Setting Value |
NavigationColor | Specifies the color of the top navigation area. | OS default color |
ButtonColor (iOS only) | Specifies the button color of the top navigation area. | OS default color |
UrlBarHiding | Hides the top URL display area when a scroll event occurs. | true |
AutoRedirectToExternalBrowser (Android only) | If the browser app set in the device's default apps is not supported, automatically supports connection to an external browser. | true |
Example code¶
The example code for 'Opening In-Game Browser using InAppBrowserParam
' 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 call successful
}
});
#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 call succeeded
}
}));
#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 call successful
}
});
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 call successful
}
}
})
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 call successful
}
};
#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 call succeeded
}
}];
Open in In-app webview¶
Opens web content in the game using a web view.
Setting functions¶
'Open in web view within the game' is implemented using the InAppWebViewParam
parameter. The useUserSession
parameter provided by the InAppWebViewParam
object can send the in-app login session to the web view, and additional information desired by the app developer can be sent via postData
.
InAppWebViewParam
parameters that can be set and their default values are as follows.
Feature | Description | Default Value | Required |
---|---|---|---|
useUserSession | This is the in-app login session information. It includes JSON data containing player_id and player_token . | false | X |
postData | This is the data containing additional information to be sent by the app developer. It is used when there is additional information that you want to display in the web view. | null | X |
Warning
When using useUserSession
, postData
must be in JSON format.
Example code¶
InAppBrowserParam
usage example code for 'Open in WebView' is as follows.
#include "HivePlatformHelper.h"
FString URL = TEXT("https://developers.withhive.com/");
FHiveInAppWebViewParam Param(URL);
Param.UseUserSession = true;
FHivePlatformHelper::ShowInAppWebView(Param, FHivePlatformHelperOnShowInAppWebViewDelegate::CreateLambda([this](const FHiveResultAPI& Result) {
if (Result.IsSuccess()) {
// API call succeeded
}
}));
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
InAppWebViewParam *param = new InAppWebViewParam("https://developers.withhive.com/");
param->useUserSession = 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)
.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)
.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]
build];
[HIVEPlatformHelper showInAppWebView: inAppWebViewParam handler: ^(HIVEResultAPI *result) {
if ([result isSuccess]) {
// API call succeeded
}
}];
Open in external browser¶
Connect an external browser to the game to call web content.
Note
'Open in external browser' is only supported in PC gaming environments, starting from Hive SDK v4 Windows 25.1.0.
Settings functions¶
You can call an external browser using OpenBrowserParam
, and additionally, you can set the useIncognitoMode
option to enable incognito mode.
'Open in external browser' is implemented using the OpenBrowserParam
parameter. You can set the incognito mode option with the useIncognitoMode
parameter.
OpenBrowserParam
parameters that can be set and their default values are as follows.
Feature | Description | Required |
---|---|---|
url | URL information to be used for calling an external browser | O |
useIncognitoMode | * true: Call in incognito mode browser * false: Call in normal mode browser | O |
Example code¶
OpenBrowserParam
usage example for 'Open in external browser' is as follows.