You can pop up a notice to users after registering an image to the console.
Show the image notice on the screen.
API
Supported Platforms ■ UNREAL_ANDROID ■ UNREAL_IOS ■ UNREAL_WINDOWS
void ShowImageNotices(FGamebaseImageNoticeConfiguration& Configuration, const FGamebaseErrorDelegate& CloseCallback);
void ShowImageNotices(FGamebaseImageNoticeConfiguration& Configuration, const FGamebaseErrorDelegate& CloseCallback, const FGamebaseImageNoticeEventDelegate& EventCallback);
Example
void USample::ShowImageNotices(int32 ColorR, int32 ColorG, int32 ColorB, int32 ColorA, int64 TimeOut)
{
FGamebaseImageNoticeConfiguration Configuration;
Configuration.BackgroundColor = FColor(ColorR, ColorG, colorB, colorA);
Configuration.TimeOut = TimeOut;
UGamebaseSubsystem* Subsystem = UGameInstance::GetSubsystem<UGamebaseSubsystem>(GetGameInstance());
Subsystem->GetImageNotice()->ShowImageNotices(Configuration,
FGamebaseErrorDelegate::CreateLambda([=](const FGamebaseError* Error) {
// Called when the entire imageNotice is closed.
...
}),
FGamebaseSchemeEventDelegate::CreateLambda([=](const FString& Scheme, const FGamebaseError* Error) {
// Called when custom event occurred.
...
})
);
}
Parameter | Values | Description |
---|---|---|
BackgroundColor | Color | Background color |
TimeOut | int64 | Image notice max loading time (in millisecond) default: 5000 |
You can call the closeImageNotices API to terminate all image notices currently being displayed.
API
Supported Platforms ■ UNREAL_ANDROID ■ UNREAL_IOS
void CloseImageNotices();
Shows the Terms and Conditions specified in the Gamebase Console.
ShowTermsView API displays the terms and conditions window in WebView. If you want to create your own terms and conditions window appropriate for the Game UI, call the QueryTerms API to load the terms and conditions set in the Gamebase console. If users agree to the terms and conditions, please use the UpdateTerms API to send the user consent of each item to the Gamebase server.
Shows the terms and conditions window on the screen. If users agree to the terms and conditions, register the user consent data in the server. If users agree to the terms and conditions, calling the ShowTermsView API again will immediately return the success callback without displaying the terms and conditions window. However, if the Terms and Conditions reconsent requirement has been changed to Required, the terms and conditions window is displayed until users agree again to the terms and conditions.
[Caution]
- FGamebasePushConfiguration is null if the terms and conditions window is not displayed. (If the terms and conditions window is displayed, a valid object is always returned.)
- FGamebasePushConfiguration.pushEnabled value is always true.
- If FGamebasePushConfiguration is not null, call IGamebase::Get().GetPush().RegisterPush() after login.
FGamebaseTermsConfiguration
API | Mandatory(M) / Optional(O) | Description |
---|---|---|
bForceShow | O | If the user agreed to the terms, calling the showTermsView API again will not display the terms and conditions window, but ignore it and force the display of the terms and conditions window. default : false |
bEnableFixedFontSize | O | Determines whether to fix the font size of the terms and conditions window. default : false Android Only |
FGamebaseShowTermsViewResult
Parameter | Values | Description |
---|---|---|
bIsTermsUIOpened | bool | true : The terms window was displayed and the user agreed, and the terms window has been closed. false : The terms window was not displayed and the terms window has been closed because the user has already agreed to the terms. |
API
Supported Platforms ■ UNREAL_ANDROID ■ UNREAL_IOS
void ShowTermsView(const FGamebaseDataContainerDelegate& Callback);
void ShowTermsView(const FGamebaseTermsConfiguration& Configuration, const FGamebaseDataContainerDelegate& Callback);
ErrorCode
Error | Error Code | Description |
---|---|---|
NOT_INITIALIZED | 1 | Gamebase not initialized. |
LAUNCHING_SERVER_ERROR | 2001 | This error occurs when the items downloaded from the launching server do not have any information about the terms and conditions. This is not a usual case, and you should contact the Gamebase personnel. |
UI_TERMS_ALREADY_IN_PROGRESS_ERROR | 6924 | The Terms API call has not been completed yet. Please try again later. |
UI_TERMS_ANDROID_DUPLICATED_VIEW | 6925 | Unfinished terms & conditions WebView has been called again. |
WEBVIEW_TIMEOUT | 7002 | Timed out while displaying the terms and conditions WebView. |
WEBVIEW_HTTP_ERROR | 7003 | An HTTP error has occurred while opening the terms and conditions WebView. |
Example
void USample::ShowTermsView()
{
FGamebaseTermsConfiguration Configuration { true };
UGamebaseSubsystem* Subsystem = UGameInstance::GetSubsystem<UGamebaseSubsystem>(GetGameInstance());
Subsystem->GetTerms()->ShowTermsView(Configuration,
FGamebaseDataContainerDelegate::CreateLambda([=](const FGamebaseDataContainer* DataContainer, const FGamebaseError* Error) {
if (Gamebase::IsSuccess(Error))
{
UE_LOG(GamebaseTestResults, Display, TEXT("ShowTermsView succeeded."));
const auto result = FGamebaseShowTermsResult::From(DataContainer);
if (result.IsValid())
{
// Save the 'PushConfiguration' and use it for RegisterPush() after Login().
SavedPushConfiguration = FGamebasePushConfiguration::From(DataContainer);
}
}
else
{
UE_LOG(GamebaseTestResults, Display, TEXT("ShowTermsView failed. (Error: %d)"), Error->Code);
}
})
);
}
void USample::AfterLogin()
{
// Call RegisterPush with saved PushConfiguration.
if (SavedPushConfiguration != null)
{
Gamebase.Push.RegisterPush(SavedPushConfiguration, (Error) =>
{
...
});
}
}
Gamebase displays the terms and conditions with a simple WebView. If you want to create the terms and conditions appropriate for the game UI, call the QueryTerms API to download the terms and conditions information set in the Gamebase Console for later use.
Calling it after login also lets you see if the game user has agreed to the terms and conditions.
[Caution]
- The required items with GamebaseResponse.Terms.ContentDetail.required set to true are not stored in the Gamebase server; therefore, false is always returned for the agreed value.
- It is because there is no point in storing the required items since they are always stored as true.
- The user consent for receiving the push notification is not stored in the Gamebase server either; therefore, the agreed value is always returned as false.
- To see if the user has agreed to receive push, use the Gamebase.Push.QueryPush API.
- If you do not touch the 'Terms and Conditions settings' in the console, UI_TERMS_NOT_EXIST_FOR_DEVICE_COUNTRY(6922) error occurs when you call the queryTerms API from the device with the country code different from the terms and conditions language.
- If you complete the 'Terms and Conditions settings' in the console or if UI_TERMS_NOT_EXIST_FOR_DEVICE_COUNTRY(6922) error occurs, please make sure the terms and conditions are not displayed.
API
Supported Platforms ■ UNREAL_ANDROID ■ UNREAL_IOS ■ UNREAL_WINDOWS
void QueryTerms(const FGamebaseQueryTermsResultDelegate& Callback);
ErrorCode
Error | Error Code | Description |
---|---|---|
NOT_INITIALIZED | 1 | Gamebase not initialized. |
UI_TERMS_NOT_EXIST_IN_CONSOLE | 6921 | Terms & conditions information is not registered with the console. |
UI_TERMS_NOT_EXIST_FOR_DEVICE_COUNTRY | 6922 | Terms & conditions information appropriate for the device's country code is not registered with the console. |
Example
void USample::QueryTerms()
{
UGamebaseSubsystem* Subsystem = UGameInstance::GetSubsystem<UGamebaseSubsystem>(GetGameInstance());
Subsystem->GetTerms()->QueryTerms(
FGamebaseQueryTermsResultDelegate::CreateLambda([=](const FGamebaseQueryTermsResult* Data, const FGamebaseError* Error) {
if (Gamebase::IsSuccess(Error))
{
UE_LOG(GamebaseTestResults, Display, TEXT("QueryTerms succeeded."));
}
else
{
UE_LOG(GamebaseTestResults, Display, TEXT("QueryTerms failed. (Error: %d)"), Error->Code);
}
})
);
}
Parameter | Values | Description |
---|---|---|
TermsSeq | int32 | KEY for the entire terms and conditions. This value is required when calling updateTerms API. |
TermsVersion | FString | T&C version. This value is required when calling updateTerms API. |
TermsCountryType | FString | Terms and conditions type. - KOREAN: Korean terms and conditions - GDPR: European terms and conditions - ETC: Other countries' terms and conditions |
Contents | TArray |
Terms and conditions info |
Parameter | Values | Description |
---|---|---|
TermsContentSeq | int32 | T&C KEY |
Name | FString | T&C Name |
bRequired | bool | Whether agreement is required |
AgreePush | FString | Whether to accept advertisement push. - NONE: Do not accept - ALL: Accept all - DAY: Accept push notification during daytime - NIGHT: Accept push notification during night time |
bAgreed | bool | User's consent to the terms and conditions |
Node1DepthPosition | int32 | Primary item exposure sequence. |
Node2DepthPosition | int32 | Secondary item exposure sequence. If none, -1 |
DetailPageUrl | FString | URL for the full terms and conditions. If none, null. |
If the UI has been created manually with the terms and conditions info downloaded from the QueryTerms API, please use the UpdateTerms API to send the game user's agreement history to the Gamebase server.
It can be used to terminate the agreement to optional terms and conditions as well as to revise the agreed T&C clauses.
[Caution]
Push accept status is not stored in the Gamebase server. Push accept status should be stored by calling the Gamebase.Push.RegisterPush API after login.
API
Supported Platforms ■ UNREAL_ANDROID ■ UNREAL_IOS ■ UNREAL_WINDOWS
void UpdateTerms(const FGamebaseUpdateTermsConfiguration& Configuration, const FGamebaseErrorDelegate Callback);
ErrorCode
Error | Error Code | Description |
---|---|---|
NOT_INITIALIZED | 1 | Gamebase not initialized. |
UI_TERMS_UNREGISTERED_SEQ | 6923 | Unregistered terms and conditions Seq value has been set. |
UI_TERMS_ALREADY_IN_PROGRESS_ERROR | 6924 | The Terms API call has not been completed yet. Please try again later. |
Example
void USample::UpdateTerms(int32 TermsSeq, const FString& TermsVersion, int32 TermsContentSeq, bool bAgreed)
{
TArray<FGamebaseTermsContent> Contents;
Contents.Add(FGamebaseTermsContent { TermsContentSeq, bAgreed });
UGamebaseSubsystem* Subsystem = UGameInstance::GetSubsystem<UGamebaseSubsystem>(GetGameInstance());
Subsystem->GetTerms()->UpdateTerms(
FGamebaseUpdateTermsConfiguration { TermsSeq, TermsVersion, Contents },
FGamebaseErrorDelegate::CreateLambda([=](const FGamebaseError* Error) {
if (Gamebase::IsSuccess(Error))
{
UE_LOG(GamebaseTestResults, Display, TEXT("UpdateTerms succeeded."));
}
else
{
UE_LOG(GamebaseTestResults, Display, TEXT("UpdateTerms failed. (Error: %d)"), Error->Code);
}
})
);
}
Parameter | Mandatory(M) / Optional(O) | Values | Description |
---|---|---|---|
TermsVersion | M | FString | T&C version. The queryTerms API must be called to pass the downloaded value. |
TermsSeq | M | int32 | KEY for the entire terms and conditions. The queryTerms API must be called to pass the downloaded value. |
Contents | M | List< Content > | Info on whether user agrees to the optional terms and conditions |
Parameter | Mandatory(M) / Optional(O) | Values | Description |
---|---|---|---|
TermsContentSeq | M | int32 | KEY for optional terms and conditions |
bAgreed | M | bool | Info on whether user agrees to optional terms and conditions |
Determines whether the current terms and conditions window is being displayed on the screen.
API
bool IsShowingTermsView();
Example
void USample::IsShowingTermsView()
{
UGamebaseSubsystem* Subsystem = UGameInstance::GetSubsystem<UGamebaseSubsystem>(GetGameInstance());
bool isShowingTermsView = Subsystem->GetTerms()->IsShowingTermsView();
UE_LOG(GamebaseTestResults, Display, TEXT("IsShowingTermsView : %s"), isShowingTermsView ? TEXT("true") : TEXT("false"));
}
Shows WebView.
API
Supported Platforms ■ UNREAL_ANDROID ■ UNREAL_IOS ■ UNREAL_WINDOWS
void ShowWebView(const FString& Url, const FGamebaseWebViewConfiguration& Configuration, FGamebaseErrorDelegate& CloseCallback, const TArray<FString>& SchemeList, const FGamebaseSchemeEventDelegate& onSchemeEvent);
Example
void USample::ShowWebView(const FString& Url)
{
FGamebaseWebViewConfiguration Configuration;
Configuration.Title = TEXT("Title");
TArray<FString> SchemeList{ TEXT("customScheme://openBrowser") };
UGamebaseSubsystem* Subsystem = UGameInstance::GetSubsystem<UGamebaseSubsystem>(GetGameInstance());
Subsystem->GetWebView()->ShowWebView(Url, Configuration,
FGamebaseErrorDelegate::CreateLambda([=](const FGamebaseError* Error) {
Result(ANSI_TO_TCHAR(__FUNCTION__), TEXT("Close webview"));
}),
SchemeList,
FGamebaseSchemeEventDelegate::CreateLambda([=](const FString& Scheme, const FGamebaseError* Error) {
if (Gamebase::IsSuccess(Error))
{
Result(ANSI_TO_TCHAR(__FUNCTION__), true, *FString::Printf(TEXT("Scheme= %s"), *Scheme));
}
else
{
Result(ANSI_TO_TCHAR(__FUNCTION__), false, GamebaseJsonUtil::UStructToJsonObjectString(*Error));
}
}));
}
Parameter | Values | Description |
---|---|---|
Title | FString | Title of WebView |
Orientation | GamebaseScreenOrientation::Unspecified | Unspecified (default) |
GamebaseScreenOrientation::Portrait | Portrait mode | |
GamebaseScreenOrientation::Landscape | Landscape mode | |
GamebaseScreenOrientation::LandscapeReverse | Rotate portrait mode 180 degrees | |
ContentMode | GamebaseWebViewContentMode::Recommended | Browser recommended by the current platform (default) |
GamebaseWebViewContentMode::Mobile | Mobile browser | |
GamebaseWebViewContentMode::Desktop | Desktop browser | |
NavigationColor | FColor | Color of Navigation Bar default: FColor(18, 93, 230, 255) |
NavigationBarHeight | height | Height of Navigation Bar Android Only |
bIsNavigationBarVisible | true or false | Activate or deactivate Navigation Bar default: true |
bIsBackButtonVisible | true or false | Activate or deactivate Go Back button default: true |
BackButtonImageResource | ID of resource | Image of Go Back button |
CloseButtonImageResource | ID of resource | Image of Close button |
bEnableFixedFontSize | true or false | Fix the font size for the terms and condtion window . default: false Only for Android |
bRenderOutSideSafeArea | true or false | Render outside Safe Area. default: false Only for Android |
[TIP]
In iPadOS 13 or later, WebView is the default desktop mode. You can use the contentMode =
GamebaseWebViewContentMode::MOBILE
setting to switch to the mobile mode.
Refers to the scheme specified by Gamebase.
Scheme | Usage |
---|---|
gamebase://dismiss | Close WebView |
gamebase://getMaintenanceInfo | Show maintenance on WebPage |
gamebase://getUserId | Show user ID of the currently logged-in game user |
gamebase://goBack | Go Back of WebView |
With the following API, you can close the Webview of the current display.
API
Supported Platforms ■ UNREAL_ANDROID ■ UNREAL_IOS ■ UNREAL_WINDOWS
void CloseWebView();
ExampleCloseWebview
void USample::CloseWebView()
{
UGamebaseSubsystem* Subsystem = UGameInstance::GetSubsystem<UGamebaseSubsystem>(GetGameInstance());
Subsystem->GetWebView()->CloseWebView();
}
With the following API, you can open an external browser. The URL sent to parameters must be valid.
API
Supported Platforms ■ UNREAL_ANDROID ■ UNREAL_IOS
void OpenWebBrowser(const FString& url);
Example
void USample::OpenWebBrowser(const FString& Url)
{
UGamebaseSubsystem* Subsystem = UGameInstance::GetSubsystem<UGamebaseSubsystem>(GetGameInstance());
Subsystem->GetWebView()->OpenWebBrowser(Url);
}
Shows notifications of the system. Callback registration is also available on the system notification.
API
Supported Platforms ■ UNREAL_ANDROID ■ UNREAL_IOS
void ShowAlert(const FString& Title, const FString& Message);
void ShowAlert(const FString& Title, const FString& Message, const FGamebaseAlertCloseDelegate& CloseCallback);
Example
void USample::ShowAlert(const FString& Title, const FString& Message)
{
UGamebaseSubsystem* Subsystem = UGameInstance::GetSubsystem<UGamebaseSubsystem>(GetGameInstance());
Subsystem->GetUtil()->ShowAlert(Title, Message);
}
void USample::ShowAlertEvent(const FString& Title, const FString& Message)
{
UGamebaseSubsystem* Subsystem = UGameInstance::GetSubsystem<UGamebaseSubsystem>(GetGameInstance());
Subsystem->GetUtil()->ShowAlert(Title, Message, FGamebaseAlertCloseDelegate::CreateLambda([=]()
{
UE_LOG(GamebaseTestResults, Display, TEXT("ShowAlert ButtonClick."));
}));
}
With the following API, it gets easy to display messages.
API
Supported Platforms ■ UNREAL_ANDROID ■ UNREAL_IOS
void ShowToast(const FString& Message, EGamebaseToastExposureTime ExposureTimeType);
Example
void USample::ShowToast(const FString& Message, EGamebaseToastExposureTime ExposureTimeType)
{
UGamebaseSubsystem* Subsystem = UGameInstance::GetSubsystem<UGamebaseSubsystem>(GetGameInstance());
Subsystem->GetUtil()->ShowToast(Message, ExposureTimeType);
}
Error | Error Code | Description |
---|---|---|
UI_IMAGE_NOTICE_TIMEOUT | 6901 | Timed out while displaying image notice. |
UI_UNKNOWN_ERROR | 6999 | Unknown (undefined) error. |