Additional functions provided by Gamebase are described as below:
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE ■ UNITY_WEBGL ■ UNITY_EDITOR
static string GetDeviceLanguageCode()
[Note]
In case of Editor on Windows or Standalone on Windows, the language code is returned based on the CultureInfo.
In case of Editor on Mac or WebGL, the language code is returned based on the Application.systemLanguage value.
For example, when Application.systemLanguage == SystemLanguage.Korean, 'ko' is returned.
Similar to the Maintenance popup, the language used by the device will be displayed as the Gamebase language.
However, there are games that may use a language different from the device language with separate options. For example, if the language configured for the device is English and you changed the game language to Japanese, the language displayed will be still English, even though you might want to see Japanese on the Gamebase screen.
For this, Gamebase provides a Display Language feature for applications that want to use a language that is not the language configured by the device for Gamebase.
Gamebase displays its messages in the language set in Display Language. The language code entered for Display Language should be one of the codes listed in the table (**Types of language codes supported by Gamebase) below:
[Caution]
- Use Display Language only when you want to change the language displayed in Gamebase to a language other than the one configured by the device.
- Display Language Code is a case-sensitive value in the form of ISO-639. There could be a problem if it is configured as a value such as 'EN' or 'zh-cn'.
- If the value entered as Display Language Code does not exist in the table (**Types of language codes supported by Gamebase) below, Display Language Code is automatically set to English (en) by default.
[Note]
- As the client messages of Gamebase include only English (en), Korean (ko), and Japanese (ja), if you try to set a language other than English (en), Korean (ko), or Japanese (ja), even though the language code might be listed in the table below, the value is automatically set to English (en) by default.
- You can manually add a language set that is not included in the Gamebase client. See the Add New Language Set section.
| Code | Name |
|---|---|
| de | German |
| en | English |
| es | Spanish |
| fi | Finnish |
| fr | French |
| id | Indonesian |
| it | Italian |
| ja | Japanese |
| ko | Korean |
| pt | Portuguese |
| ru | Russian |
| th | Thai |
| vi | Vietnamese |
| ms | Malay |
| zh-CN | Chinese-Simplified |
| zh-TW | Chinese-Traditional |
Each language code is defined in GamebaseDisplayLanguageCode.
namespace Toast.Gamebase
{
public class GamebaseDisplayLanguageCode
{
public const string German = "de";
public const string English = "en";
public const string Spanish = "es";
public const string Finnish = "fi";
public const string French = "fr";
public const string Indonesian = "id";
public const string Italian = "it";
public const string Japanese = "ja";
public const string Korean = "ko";
public const string Portuguese = "pt";
public const string Russian = "ru";
public const string Thai = "th";
public const string Vietnamese = "vi";
public const string Malay = "ms";
public const string Chinese_Simplified = "zh-CN";
public const string Chinese_Traditional = "zh-TW";
}
}
Display Language can be set when Gamebase is initialized.
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE ■ UNITY_WEBGL ■ UNITY_EDITOR
static void Initialize(GamebaseRequest.GamebaseConfiguration configuration, GamebaseCallback.GamebaseDelegate<GamebaseResponse.Launching.LaunchingInfo> callback)
Example
public void InitializeWithConfiguration()
{
var configuration = new GamebaseRequest.GamebaseConfiguration();
...
configuration.displayLanguageCode = displayLanguage;
...
Gamebase.Initialize(configuration, (launchingInfo, error) =>
{
if (Gamebase.IsSuccess(error))
{
Debug.Log("Gamebase initialization succeeded.");
string displayLanguage = Gamebase.GetDisplayLanguageCode();
}
else
{
Debug.Log(string.Format("Gamebase initialization failed. error is {0}", error));
}
});
}
You can change the initial setting of Display Language.
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE ■ UNITY_WEBGL ■ UNITY_EDITOR
static void SetDisplayLanguageCode(string languageCode)
Example
public void SetDisplayLanguageCode()
{
Gamebase.SetDisplayLanguageCode(GamebaseDisplayLanguageCode.English);
}
You can retrieve the current application of Display Language.
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE ■ UNITY_WEBGL ■ UNITY_EDITOR
static string GetDisplayLanguageCode()
Example
public void GetDisplayLanguageCode()
{
string displayLanguage = Gamebase.GetDisplayLanguageCode();
}
For UnityEditor and Unity Standalone, or WebGL platform services, to use another language in addition to default Gamebase languages (ko, en, ja), go to Assets > StreamingAssets > Gamebase and add a value to the localizedstring.json file.

The localizedstring.json has a format defined as below:
{
"en": {
"common_ok_button": "OK",
"common_cancel_button": "Cancel",
...
"launching_service_closed_title": "Service Closed"
},
"ko": {
"common_ok_button": "확인",
"common_cancel_button": "취소",
...
"launching_service_closed_title": "서비스 종료"
},
"ja": {
"common_ok_button": "確認",
"common_cancel_button": "キャンセル",
...
"launching_service_closed_title": "サービス終了"
},
}
To add another language, add "${language code}":{"key":"value"} to the localizedstring.json file.
{
"en": {
"common_ok_button": "OK",
"common_cancel_button": "Cancel",
...
"launching_service_closed_title": "Service Closed"
},
"ko": {
"common_ok_button": "확인",
"common_cancel_button": "취소",
...
"launching_service_closed_title": "서비스 종료"
},
"ja": {
"common_ok_button": "確認",
"common_cancel_button": "キャンセル",
...
"launching_service_closed_title": "サービス終了"
},
"${언어코드}": {
"common_ok_button": "...",
...
}
}
Refer to the guides below to learn how to add new language sets for Unity Android and iOS platforms.
If Display Language is set via initialization and SetDisplayLanguageCode API, the final application may be different from what has been entered.
en, which is the default value of Display Language, is automatically set.API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID
static string GetCountryCodeOfUSIM()
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID
static string GetCountryCodeOfDevice()

[Note]
In case of Editor on Windows or Standalone on Windows, the country code is returned based on the CultureInfo.
In case of Editor on Mac or WebGL, the country code is returned based on the Application.systemLanguage value.
For example, when Application.systemLanguage == SystemLanguage.Korean, 'KR' is returned.
API
■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE ■ UNITY_WEBGL ■ UNITY_EDITOR
public static string GetCountryCode()
API
■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE ■ UNITY_WEBGL ■ UNITY_EDITOR
public static void Gamebase.AddEventHandler(GamebaseCallback.DataDelegate<GamebaseResponse.Event.GamebaseEventMessage> eventHandler);
public static void Gamebase.RemoveEventHandler(GamebaseCallback.DataDelegate<GamebaseResponse.Event.GamebaseEventMessage> eventHandler);
public static void Gamebase.RemoveAllEventHandler();
VO
public class GamebaseEventMessage
{
// Represents the type of an event.
// The value of the GamebaseEventCategory class is assigned.
public string category;
// JSON String data that can be converted into a VO that is appropriate for each category.
public string data;
}
Example
public void AddEventHandlerSample()
{
Gamebase.AddEventHandler(GamebaseObserverHandler);
}
private void GamebaseObserverHandler(GamebaseResponse.Event.GamebaseEventMessage message)
{
switch (message.category)
{
case GamebaseEventCategory.IDP_REVOKED:
{
GamebaseResponse.Event.GamebaseEventIdPRevokedData idPRevokedData = GamebaseResponse.Event.GamebaseEventIdPRevokedData.From(message.data);
if (idPRevokedData != null)
{
ProcessIdPRevoked(idPRevokedData);
}
break;
}
case GamebaseEventCategory.LOGGED_OUT:
{
GamebaseResponse.Event.GamebaseEventLoggedOutData loggedData = GamebaseResponse.Event.GamebaseEventLoggedOutData.From(message.data);
if (loggedData != null)
{
// There was a problem with the access token.
// Call login again.
}
break;
}
case GamebaseEventCategory.SERVER_PUSH_APP_KICKOUT_MESSAGE_RECEIVED:
case GamebaseEventCategory.SERVER_PUSH_APP_KICKOUT:
case GamebaseEventCategory.SERVER_PUSH_TRANSFER_KICKOUT:
{
GamebaseResponse.Event.GamebaseEventServerPushData serverPushData = GamebaseResponse.Event.GamebaseEventServerPushData.From(message.data);
if (serverPushData != null)
{
CheckServerPush(message.category, serverPushData);
}
break;
}
case GamebaseEventCategory.OBSERVER_LAUNCHING:
{
GamebaseResponse.Event.GamebaseEventObserverData observerData = GamebaseResponse.Event.GamebaseEventObserverData.From(message.data);
if(observerData != null)
{
CheckLaunchingStatus(observerData);
}
break;
}
case GamebaseEventCategory.OBSERVER_NETWORK:
{
GamebaseResponse.Event.GamebaseEventObserverData observerData = GamebaseResponse.Event.GamebaseEventObserverData.From(message.data);
if (observerData != null)
{
CheckNetwork(observerData);
}
break;
}
case GamebaseEventCategory.OBSERVER_HEARTBEAT:
{
GamebaseResponse.Event.GamebaseEventObserverData observerData = GamebaseResponse.Event.GamebaseEventObserverData.From(message.data);
if (observerData != null)
{
CheckHeartbeat(observerData);
}
break;
}
case GamebaseEventCategory.OBSERVER_WEBVIEW:
{
GamebaseResponse.Event.GamebaseEventObserverData observerData = GamebaseResponse.Event.GamebaseEventObserverData.From(message.data);
if (observerData != null)
{
CheckWebView(observerData);
}
break;
}
case GamebaseEventCategory.OBSERVER_INTROSPECT:
{
// Introspect error
GamebaseResponse.Event.GamebaseEventObserverData observerData = GamebaseResponse.Event.GamebaseEventObserverData.From(message.data);
int errorCode = observerData.code;
string errorMessage = observerData.message;
break;
}
case GamebaseEventCategory.PURCHASE_UPDATED:
{
GamebaseResponse.Event.PurchasableReceipt purchasableReceipt = GamebaseResponse.Event.PurchasableReceipt.From(message.data);
if (purchasableReceipt != null)
{
// If the user got item by 'Promotion Code',
// this event will be occurred.
}
break;
}
case GamebaseEventCategory.PUSH_RECEIVED_MESSAGE:
{
GamebaseResponse.Event.PushMessage pushMessage = GamebaseResponse.Event.PushMessage.From(message.data);
if (pushMessage != null)
{
// When you received push message.
// By converting the extras field of the push message to JSON,
// you can get the custom information added by the user when sending the push.
// (For Android, an 'isForeground' field is included so that you can check if received in the foreground state.)
}
break;
}
case GamebaseEventCategory.PUSH_CLICK_MESSAGE:
{
GamebaseResponse.Event.PushMessage pushMessage = GamebaseResponse.Event.PushMessage.From(message.data);
if (pushMessage != null)
{
// When you clicked push message.
}
break;
}
case GamebaseEventCategory.PUSH_CLICK_ACTION:
{
GamebaseResponse.Event.PushAction pushAction = GamebaseResponse.Event.PushAction.From(message.data);
if (pushAction != null)
{
// When you clicked action button by 'Rich Message'.
}
break;
}
}
}
Event type |
GamebaseEventCategory | VO conversion method | Remarks |
|---|---|---|---|
| IdPRevoked | GamebaseEventCategory.IDP_REVOKED | GamebaseResponse.Event.GamebaseEventIdPRevokedData.from(message.data) | - |
| LoggedOut | GamebaseEventCategory.LOGGED_OUT | GamebaseResponse.Event.GamebaseEventLoggedOutData.from(message.data) | - |
| ServerPush | GamebaseEventCategory.SERVER_PUSH_APP_KICKOUT_MESSAGE_RECEIVED GamebaseEventCategory.SERVER_PUSH_APP_KICKOUT GamebaseEventCategory.SERVER_PUSH_TRANSFER_KICKOUT |
GamebaseResponse.Event.GamebaseEventServerPushData.from(message.data) | - |
| Observer | GamebaseEventCategory.OBSERVER_LAUNCHING GamebaseEventCategory.OBSERVER_NETWORK GamebaseEventCategory.OBSERVER_HEARTBEAT |
GamebaseResponse.Event.GamebaseEventObserverData.from(message.data) | - |
| Purchase - Promotion payment | GamebaseEventCategory.PURCHASE_UPDATED | GamebaseResponse.Event.PurchasableReceipt.from(message.data) | - |
| Push - Message received | GamebaseEventCategory.PUSH_RECEIVED_MESSAGE | GamebaseResponse.Event.PushMessage.from(message.data) | |
| Push - Message clicked | GamebaseEventCategory.PUSH_CLICK_MESSAGE | GamebaseResponse.Event.PushMessage.from(message.data) | |
| Push - Action clicked | GamebaseEventCategory.PUSH_CLICK_ACTION | GamebaseResponse.Event.PushAction.from(message.data) | Operates when the RichMessage button is clicked. |
[Note]
This is an event that only occur when using iOS Appleid login.
You must inform users that the IdP has been disabled and instruct them to log out and log back in.
GamebaseEventIdPRevokedData.idpType: Indicates the revoked IdP type.
Example
public void AddEventHandlerSample()
{
Gamebase.AddEventHandler(GamebaseEventHandler);
}
private void GamebaseEventHandler(GamebaseResponse.Event.GamebaseEventMessage message)
{
switch (message.category)
{
case GamebaseEventCategory.IDP_REVOKED:
{
GamebaseResponse.Event.GamebaseEventIdPRevokedData idPRevokedData = GamebaseResponse.Event.GamebaseEventIdPRevokedData.From(message.data);
if (idPRevokedData != null)
{
// Call logout, then login again.
}
break;
}
default:
{
break;
}
}
}
Example
public void AddEventHandlerSample()
{
Gamebase.AddEventHandler(GamebaseEventHandler);
}
private void GamebaseEventHandler(GamebaseResponse.Event.GamebaseEventMessage message)
{
switch (message.category)
{
case GamebaseEventCategory.LOGGED_OUT:
{
GamebaseResponse.Event.GamebaseEventLoggedOutData loggedData = GamebaseResponse.Event.GamebaseEventLoggedOutData.From(message.data);
if (loggedData != null)
{
// There was a problem with the access token.
// Call login again.
}
break;
}
}
}
Example
public void AddEventHandlerSample()
{
Gamebase.AddEventHandler(GamebaseEventHandler);
}
private void GamebaseEventHandler(GamebaseResponse.Event.GamebaseEventMessage message)
{
switch (message.category)
{
case GamebaseEventCategory.SERVER_PUSH_APP_KICKOUT_MESSAGE_RECEIVED:
case GamebaseEventCategory.SERVER_PUSH_APP_KICKOUT:
case GamebaseEventCategory.SERVER_PUSH_TRANSFER_KICKOUT:
{
GamebaseResponse.Event.GamebaseEventServerPushData serverPushData = GamebaseResponse.Event.GamebaseEventServerPushData.From(message.data);
if (serverPushData != null)
{
CheckServerPush(message.category, serverPushData);
}
break;
}
default:
{
break;
}
}
}
private void CheckServerPush(string category, GamebaseResponse.Event.GamebaseEventServerPushData data)
{
if (category.Equals(GamebaseEventCategory.SERVER_PUSH_APP_KICKOUT) == true)
{
// Kicked out from Gamebase server.(Maintenance, banned or etc.)
// And the game user closes the kickout pop-up.
// Return to title and initialize Gamebase again.
}
else if (category.Equals(GamebaseEventCategory.SERVER_PUSH_APP_KICKOUT_MESSAGE_RECEIVED) == true)
{
// Currently, the kickout pop-up is displayed.
// If your game is running, stop it.
}
else if (category.Equals(GamebaseEventCategory.SERVER_PUSH_TRANSFER_KICKOUT) == true)
{
// If the user wants to move the guest account to another device,
// if the account transfer is successful,
// the login of the previous device is released,
// so go back to the title and try to log in again.
}
}
VO
public class GamebaseEventObserverData
{
// This information represents the status value.
public int code;
// This information shows the message about status.
public string message;
// A reserved field for additional information.
public string extras;
}
Example
public void AddEventHandlerSample()
{
Gamebase.AddEventHandler(GamebaseEventHandler);
}
private void GamebaseEventHandler(GamebaseResponse.Event.GamebaseEventMessage message)
{
switch (message.category)
{
case GamebaseEventCategory.OBSERVER_LAUNCHING:
{
GamebaseResponse.Event.GamebaseEventObserverData observerData = GamebaseResponse.Event.GamebaseEventObserverData.From(message.data);
if(observerData != null)
{
CheckLaunchingStatus(observerData);
}
break;
}
case GamebaseEventCategory.OBSERVER_NETWORK:
{
GamebaseResponse.Event.GamebaseEventObserverData observerData = GamebaseResponse.Event.GamebaseEventObserverData.From(message.data);
if (observerData != null)
{
CheckNetwork(observerData);
}
break;
}
case GamebaseEventCategory.OBSERVER_HEARTBEAT:
{
GamebaseResponse.Event.GamebaseEventObserverData observerData = GamebaseResponse.Event.GamebaseEventObserverData.From(message.data);
if (observerData != null)
{
CheckHeartbeat(observerData);
}
break;
}
case GamebaseEventCategory.OBSERVER_WEBVIEW:
{
GamebaseResponse.Event.GamebaseEventObserverData observerData = GamebaseResponse.Event.GamebaseEventObserverData.From(message.data);
if (observerData != null)
{
CheckWebView(observerData);
}
break;
}
case GamebaseEventCategory.OBSERVER_INTROSPECT:
{
// Introspect error
GamebaseResponse.Event.GamebaseEventObserverData observerData = GamebaseResponse.Event.GamebaseEventObserverData.From(message.data);
int errorCode = observerData.code;
string errorMessage = observerData.message;
break;
}
default:
{
break;
}
}
}
private void CheckLaunchingStatus(GamebaseResponse.Event.GamebaseEventObserverData observerData)
{
switch (observerData.code)
{
case GamebaseLaunchingStatus.IN_SERVICE:
{
// Service is now normally provided.
break;
}
// ...
case GamebaseLaunchingStatus.INTERNAL_SERVER_ERROR:
{
// Error in internal server.
break;
}
}
}
private void CheckNetwork(GamebaseResponse.Event.GamebaseEventObserverData observerData)
{
switch ((GamebaseNetworkType)observerData.code)
{
case GamebaseNetworkType.TYPE_NOT:
{
// Network disconnected.
break;
}
case GamebaseNetworkType.TYPE_MOBILE:
case GamebaseNetworkType.TYPE_WIFI:
case GamebaseNetworkType.TYPE_ANY:
{
// Network connected.
break;
}
}
}
private void CheckHeartbeat(GamebaseResponse.Event.GamebaseEventObserverData observerData)
{
switch (observerData.code)
{
case GamebaseErrorCode.INVALID_MEMBER:
{
// You can check the invalid user session in here.
// ex) After transferred account to another device.
break;
}
case GamebaseErrorCode.BANNED_MEMBER:
{
// You can check the banned user session in here.
break;
}
}
}
private void CheckWebView(GamebaseResponse.Event.GamebaseEventObserverData observerData)
{
switch (observerData.code)
{
case GamebaseWebViewEventType.OPENED:
{
// WebView opened.
break;
}
case GamebaseWebViewEventType.CLOSED:
{
// WebView closed.
break;
}
}
}
Example
public void AddEventHandlerSample()
{
Gamebase.AddEventHandler(GamebaseEventHandler);
}
private void GamebaseEventHandler(GamebaseResponse.Event.GamebaseEventMessage message)
{
switch (message.category)
{
case GamebaseEventCategory.PURCHASE_UPDATED:
{
GamebaseResponse.Event.PurchasableReceipt purchasableReceipt = GamebaseResponse.Event.PurchasableReceipt.From(message.data);
if (purchasableReceipt != null)
{
// If a promotion or pending purchase is completed, this event will be occurred.
}
break;
}
default:
{
break;
}
}
}
VO
public class PushMessage
{
// The unique ID of a message.
public string id;
// The title of the push message.
public string title;
// The body of the push message.
public string body;
// You can check the custom information sent when sending a push in JSON format.
public string extras;
}
Example
public void AddEventHandlerSample()
{
Gamebase.AddEventHandler(GamebaseEventHandler);
}
private void GamebaseEventHandler(GamebaseResponse.Event.GamebaseEventMessage message)
{
switch (message.category)
{
case GamebaseEventCategory.PUSH_RECEIVED_MESSAGE:
{
GamebaseResponse.Event.PushMessage pushMessage = GamebaseResponse.Event.PushMessage.From(message.data);
if (pushMessage != null)
{
// When you received push message.
// By converting the extras field of the push message to JSON,
// you can get the custom information added by the user when sending the push.
// (For Android, an 'isForeground' field is included so that you can check if received in the foreground state.
}
break;
}
default:
{
break;
}
}
}
Example
public void AddEventHandlerSample()
{
Gamebase.AddEventHandler(GamebaseEventHandler);
}
private void GamebaseEventHandler(GamebaseResponse.Event.GamebaseEventMessage message)
{
switch (message.category)
{
case GamebaseEventCategory.PUSH_CLICK_MESSAGE:
{
GamebaseResponse.Event.PushMessage pushMessage = GamebaseResponse.Event.PushMessage.From(message.data);
if (pushMessage != null)
{
// When you clicked push message.
}
break;
}
default:
{
break;
}
}
}
VO
class PushAction
{
// Button action type.
public string actionType;
// PushMessage data.
public PushMessage message;
// User text typed in Push console.
public string userText;
}
Example
public void AddEventHandlerSample()
{
Gamebase.AddEventHandler(GamebaseEventHandler);
}
private void GamebaseEventHandler(GamebaseResponse.Event.GamebaseEventMessage message)
{
switch (message.category)
{
case GamebaseEventCategory.PUSH_CLICK_ACTION:
{
GamebaseResponse.Event.PushAction pushAction = GamebaseResponse.Event.PushAction.From(message.data);
if (pushAction != null)
{
// When you clicked action button by 'Rich Message'.
}
break;
}
default:
{
break;
}
}
}
The game index can be transferred to the Gamebase server.
[Caution]
All APIs supported by the Gamebase Analytics can be called after login.
[TIP]
When the Gamebase.Purchase.RequestPurchase API is called and payment is completed, an index is automatically transferred.
Please see the following guide for how to use Analytics console.
The game user level information can be transmitted as an index after logging in to the game.
[Caution]
If the SetGameUserData API is not called after login to the game, the level information may be missed from other indexes.
Parameters required for calling the API are as follows:
GameUserData
| Name | Mandatory(M) / Optional(O) | type | Desc |
|---|---|---|---|
| userLevel | M | int | Describes the level of game user. |
| channelId | O | string | Describes the channel. |
| characterId | O | string | Describes the name of character. |
| characterClassId | O | string | Describes the occupation. |
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE ■ UNITY_WEBGL ■ UNITY_EDITOR
static void SetGameUserData(GamebaseRequest.Analytics.GameUserData gameUserData)
Example
public void SetGameUserData(int userLevel, string channelId, string characterId, string characterClassId)
{
GamebaseRequest.Analytics.GameUserData gameUserData = new GamebaseRequest.Analytics.GameUserData(userLevel);
gameUserData.channelId = channelId;
gameUserData.characterId = characterId;
gameUserData.characterClassId = characterClassId;
Gamebase.Analytics.SetGameUserData(gameUserData);
}
The game user level information can be transmitted as an index after leveling up.
Parameters required for calling the API are as follows:
LevelUpData
| Name | Mandatory(M) / Optional(O) | type | Desc |
|---|---|---|---|
| userLevel | M | int | Describes the level of game user. |
| levelUpTime | M | long | Enter Epoch Timein millisecond. |
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE ■ UNITY_WEBGL ■ UNITY_EDITOR
static void TraceLevelUp(GamebaseRequest.Analytics.LevelUpData levelUpData)
Example
public void TraceLevelUp(int userLevel, long levelUpTime)
{
GamebaseRequest.Analytics.LevelUpData levelUpData = new GamebaseRequest.Analytics.LevelUpData(userLevel, levelUpTime);
Gamebase.Analytics.TraceLevelUp(levelUpData);
}
Gamebase provides features to respond to customer inquiries.
[TIP]
Associate it with the NHN Cloud Contact service to easily respond to inquiries from customers. See the guide below if you want to know how to use the NHN Cloud Contact service in detail. NHN Cloud Online Contact Guide
In the Gamebase Console > App > Customer service, you can choose from three different types of Customer Centers.

| Customer Service Type | Required Login |
|---|---|
| Developer customer center | X |
| Gamebase customer center | △ |
| NHN Cloud Online Contact | △ |
Gamebase SDK's Customer Center API uses the following URLs based on the type:
Displays the Customer Center WebView. URL is determined by the customer center type. You can pass the additional information to the URL using ContactConfiguration.
GamebaseRequest.Contact.Configuration
| Parameter | Mandatory(M) / Optional(O) |
Values | Description |
|---|---|---|---|
| userName | O | string | User name (nickname) default: null |
| additionalURL | O | string | Additional URL appended to the developer's own customer center URL default: null |
| additionalParameters | O | Dictionary |
Additional parameters appended to the contact center URL default: null |
| extraData | O | Dictionary |
Passes the extra data wanted by the developer when opening the customer center default: null |
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE
static void OpenContact(GamebaseCallback.ErrorDelegate callback);
static void OpenContact(GamebaseRequest.Contact.Configuration configuration, GamebaseCallback.ErrorDelegate callback);
ErrorCode
| Error Code | Description |
|---|---|
| NOT_INITIALIZED(1) | Gamebase.initialize has not been called. |
| UI_CONTACT_FAIL_INVALID_URL(6911) | The Customer Center URL does not exist. Check the Customer Center URL of the Gamebase Console. |
| UI_CONTACT_FAIL_ISSUE_SHORT_TERM_TICKET(6912) | Failed to issue a temporary ticket for user identification. |
| UI_CONTACT_FAIL_ANDROID_DUPLICATED_VIEW(6913) | The Customer Center WebView is already being displayed. |
Example
public void SampleOpenContact()
{
Gamebase.Contact.OpenContact((error) =>
{
if (Gamebase.IsSuccess(error) == true)
{
// A user close the contact web view.
}
else if (error.code == GamebaseErrorCode.UI_CONTACT_FAIL_INVALID_URL) // 6911
{
// TODO: Gamebase Console Service Center URL is invalid.
// Please check the url field in the NHN Cloud Gamebase Console.
}
else if (error.code == GamebaseErrorCode.UI_CONTACT_FAIL_ANDROID_DUPLICATED_VIEW) // 6913
{
// The customer center web view is already opened.
}
else
{
// An error occur when opening the contact web view.
}
});
}
[Caution]
Contacting the Customer Center may require file attachment. To do so, permissions for using the camera or using the storage must be acquired from the user at runtime.
Android user
Unity users can implement this by referring to the following guide. Unity Guide : Requesting Permissions
iOS user
- Please set 'Privacy - Camera Usage Description', 'Privacy - Photo Library Usage Description' in info.plist.
Returns the URL used for displaying the Customer Center WebView.
API
static void RequestContactURL(GamebaseCallback.GamebaseDelegate<string> callback);
static void RequestContactURL(GamebaseRequest.Contact.Configuration configuration, GamebaseCallback.GamebaseDelegate<string> callback);
ErrorCode
| Error Code | Description |
|---|---|
| NOT_INITIALIZED(1) | Gamebase.initialize has not been called. |
| UI_CONTACT_FAIL_INVALID_URL(6911) | The Customer Center URL does not exist. Check the Customer Center URL of the Gamebase Console. |
| UI_CONTACT_FAIL_ISSUE_SHORT_TERM_TICKET(6912) | Failed to issue a temporary ticket for user identification. |
Example
public void SampleRequestContactURL()
{
var configuration = new GamebaseRequest.Contact.Configuration()
{
userName = "User Name"
};
Gamebase.Contact.RequestContactURL(configuration, (url, error) =>
{
if (Gamebase.IsSuccess(error) == true)
{
// Open webview with 'contactUrl'
}
else if (error.code == GamebaseErrorCode.UI_CONTACT_FAIL_INVALID_URL) // 6911
{
// TODO: Gamebase Console Service Center URL is invalid.
// Please check the url field in the NHN Cloud Gamebase Console.
}
else
{
// An error occur when requesting the contact web view url.
}
});
}
Check the ATT status.
AUTHORIZED : tracking permitted. Always returned on versions below iOS 14
API
Supported Platforms ■ UNITY_IOS
namespace Toast.Gamebase
{
public enum GamebaseAppTrackingAuthorizationStatus
{
AUTHORIZED,
DENIED,
NOT_DETERMINED,
RESTRICTED,
UNKNOWN
}
}
static Toast.Gamebase.GamebaseAppTrackingAuthorizationStatus GetAppTrackingAuthorizationStatus();
Example
public void GetAppTrackingAuthorizationStatusSample()
{
#if UNITY_IOS
switch (Gamebase.Util.GetAppTrackingAuthorizationStatus() ) iOS only
{
case GamebaseAppTrackingAuthorizationStatus.AUTHORIZED:
{
}
break;
case GamebaseAppTrackingAuthorizationStatus.DENIED:
{
}
break;
case GamebaseAppTrackingAuthorizationStatus.NOT_DETERMINED:
{
}
break;
case GamebaseAppTrackingAuthorizationStatus.RESTRICTED:
{
}
break;
case GamebaseAppTrackingAuthorizationStatus.UNKNOWN:
{
}
break;
}
#endif
}
To configure IDFA settings on iOS, please refer to the following documentation.
* iOS IDFA
API
Supported Platforms ■ UNITY_IOS
static void GetIdfa();
Example
public void SampleGetIdfa()
{
#if UNITY_IOS
string idfa = Gamebase.Util.GetIdfa(); iOS only
#endif
}
Texas SB 2420 and similar state laws require apps to verify users' ages to protect minors. Gamebase provides an API that wraps the Google Play Age Signals API to meet these requirements.
Please refer to the following article for how to set up the Age Signals feature on Android:
* Android Age Signals
Supported Platforms ■ UNITY_ANDROID
Check the age information.
API
static void GetAgeSignal(GamebaseCallback.GamebaseDelegate<GamebaseResponse.Util.AgeSignalResult> callback)
ErrorCode
| Error Code | Description |
|---|---|
| NOT_SUPPORTED(10) | Called on devices with Android API lower than version 23. |
| AUTH_EXTERNAL_LIBRARY_ERROR(3009) | Google Play Age Signals API returned an error. |
Handle results
You can check a user's status with AgeSignalResult.userStatus. Please determine whether to restrict the user based on the Status value.
GamebaseAgeSignalsVerificationStatus
A user verification status constant.
| Status | Code | Description |
|---|---|---|
| VERIFIED | 0 | Adult (18 years or older) |
| SUPERVISED | 1 | Minor with parental consent |
| SUPERVISED_APPROVAL_PENDING | 2 | Pending parental approval |
| SUPERVISED_APPROVAL_DENIED | 3 | Parental approval denied |
| UNKNOWN | 4 | Unverified user |
Example
``` cs public static void SampleGetAgeSignal() { Gamebase.Util.GetAgeSignal((data, error) => { if (Gamebase.IsSuccess(error) == true) { HandleAgeSignalsResult(data); } else { var errorCode = error.code; var errorMessage = error.message; switch (errorCode) { case GamebaseErrorCode.NOT_SUPPORTED: // Not supported on devices with Android API lower than version 23. Debug.LogError("Age Signals API is not supported on this device"); break; case GamebaseErrorCode.AUTH_EXTERNAL_LIBRARY_ERROR: // An error occurred in Google Play Services. Debug.LogErrorFormat("Google Play Age Signals error: {0}", errorMessage); break; } } }); }
private static void HandleAgeSignalsResult(GamebaseResponse.Util.AgeSignalResult result) { if(result.userStatus.HasValue == false) { // It means the user is not in a regulated area (Texas, Utah, Louisiana). // You can proceed with your app's logic for non-regulated users. return; }
GamebaseAgeSignalsVerificationStatus userStatus = (GamebaseAgeSignalsVerificationStatus)result.userStatus.Value;
switch (userStatus)
{
case GamebaseAgeSignalsVerificationStatus.VERIFIED:
// Adult users 18 years or older
// Allow access to all features
// ageLower and ageUpper are null
HandleAdultUser(result);
break;
case GamebaseAgeSignalsVerificationStatus.SUPERVISED:
// Minors with parental consent
// Limited functionality available for minors under Texas SB 2420
// You can check the age range.
var ageLower = result.ageLower.Value; // e.g. 13
var ageUpper = result.ageUpper.Value; // e.g. 17
var installId = result.installId;
HandleSupervisedMinor(result);
break;
case GamebaseAgeSignalsVerificationStatus.SUPERVISED_APPROVAL_PENDING:
// Limited feature is available while waiting for parental approval.
// Notify the user that approval is pending.
HandleApprovalPending(result);
break;
case GamebaseAgeSignalsVerificationStatus.SUPERVISED_APPROVAL_DENIED:
// If your guardian refuses permission,
// you will be notified that only limited features are available or the service is unavailable.
HandleApprovalDenied(result);
break;
case GamebaseAgeSignalsVerificationStatus.UNKNOWN:
// If the user is unverified or age verification information is unavailable in your jurisdiction,
// ask the user to visit the Play Store to resolve the issue.