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.
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)
{
ProcessIdPRevoked(idPRevokedData);
}
break;
}
default:
{
break;
}
}
}
private void ProcessIdPRevoked(string category, GamebaseResponse.Event.GamebaseEventIdPRevokedData data)
{
var revokedIdP = data.idPType;
switch (data.code)
{
case GamebaseIdPRevokedCode.WITHDRAW:
{
// The user is logged in with a revoked IdP and there is no list of mapped IdPs.
// Notifies the user that the current account has been removed.
Gamebase.Withdraw((error) =>
{
...
});
break;
}
case GamebaseIdPRevokedCode.OVERWRITE_LOGIN_AND_REMOVE_MAPPING:
{
// The user is logged in with a revoked IdP and IdPs other than the revoked IdP are mapped.
// Allows the user to select an IdP to login in to among the authMappingList, and removes mapping with the revoked IdP after login with the selected IdP.
var selectedIdP = "the IdP selected by the user";
var additionalInfo = new Dictionary<string, object>()
{
{ GamebaseAuthProviderCredential.IGNORE_ALREADY_LOGGED_IN, true }
};
Gamebase.Login(selectedIdP, additionalInfo, (authToken, loginError) =>
{
if (Gamebase.IsSuccess(loginError) == true)
{
Gamebase.RemoveMapping(revokedIdP, (mappingError) =>
{
...
});
}
});
break;
}
case GamebaseIdPRevokedCode.REMOVE_MAPPING:
{
// There is a revoked IdP among IdPs mapped to the current account.
// Notifies the user that mapping with the revoked IdP is removed from the current account.
Gamebase.RemoveMapping(revokedIdP, (error) =>
{
...
});
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 the user got item by 'Promotion Code',
// 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 > InApp URL > Service Center, 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.
}
});
}
Texas SB 2420 및 유사한 주 법률은 미성년자 보호를 위해 앱에서 사용자의 연령 확인을 요구합니다. Gamebase는 Google Play Age Signals API를 래핑하여 이러한 요구사항을 충족할 수 있는 API를 제공합니다.
Android에서 Age Signals 기능을 설정하는 방법은 다음 문서를 참고하시기 바랍니다.
* Android Age Signals
Supported Platforms ■ UNITY_ANDROID
연령 정보를 확인합니다.
API
static void GetAgeSignal(GamebaseCallback.GamebaseDelegate<GamebaseResponse.Util.AgeSignalResult> callback)
ErrorCode
| Error Code | Description |
|---|---|
| NOT_SUPPORTED(10) | Android API 23 미만 기기에서 호출되었습니다. |
| AUTH_EXTERNAL_LIBRARY_ERROR(3009) | Google Play Age Signals API에서 에러를 리턴하였습니다. |
Handle results
AgeSignalResult.userStatus로 유저의 상태를 확인할 수 있습니다. Status 값에 따라 사용자 규제 여부를 판단하시기 바랍니다.
GamebaseAgeSignalsVerificationStatus
사용자 검증 상태 상수입니다.
| Status | Code | Description |
|---|---|---|
| VERIFIED | 0 | 18세 이상 성인 |
| SUPERVISED | 1 | 보호자 동의가 있는 미성년자 |
| SUPERVISED_APPROVAL_PENDING | 2 | 보호자 승인 대기 중 |
| SUPERVISED_APPROVAL_DENIED | 3 | 보호자 승인 거부됨 |
| UNKNOWN | 4 | 검증되지 않은 사용자 |
Example
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:
// Android API 23 미만 기기에서는 지원되지 않습니다.
Debug.LogError("Age Signals API is not supported on this device");
break;
case GamebaseErrorCode.AUTH_EXTERNAL_LIBRARY_ERROR:
// Google Play 서비스에서 에러가 발생하였습니다.
Debug.LogErrorFormat("Google Play Age Signals error: {0}", errorMessage);
break;
}
}
});
}
private static void HandleAgeSignalsResult(GamebaseResponse.Util.AgeSignalResult result)
{
if(result.userStatus.HasValue == false)
{
// 사용자가 규제 지역(텍사스, 유타, 루이지애나)에 있지 않음을 의미합니다.
// 규제 대상이 아닌 사용자에 대한 앱의 로직을 진행할 수 있습니다.
return;
}
GamebaseAgeSignalsVerificationStatus userStatus = (GamebaseAgeSignalsVerificationStatus)result.userStatus.Value;
switch (userStatus)
{
case GamebaseAgeSignalsVerificationStatus.VERIFIED:
// 18세 이상 성인 사용자
// 모든 기능에 대한 접근 허용
// ageLower와 ageUpper는 null입니다
HandleAdultUser(result);
break;
case GamebaseAgeSignalsVerificationStatus.SUPERVISED:
// 보호자 동의가 있는 미성년자
// Texas SB 2420에 따라 미성년자를 위한 제한된 기능 제공
// 연령대를 확인할 수 있습니다.
var ageLower = result.ageLower.Value; // 예: 13
var ageUpper = result.ageUpper.Value; // 예: 17
var installId = result.installId;
HandleSupervisedMinor(result);
break;
case GamebaseAgeSignalsVerificationStatus.SUPERVISED_APPROVAL_PENDING:
// 보호자 승인을 기다리는 동안 제한된 기능만 제공
// 사용자에게 승인 대기 중임을 알림
HandleApprovalPending(result);
break;
case GamebaseAgeSignalsVerificationStatus.SUPERVISED_APPROVAL_DENIED:
// 보호자가 승인을 거부한 경우
// 제한된 기능만 제공하거나 서비스 이용 불가 안내
HandleApprovalDenied(result);
break;
case GamebaseAgeSignalsVerificationStatus.UNKNOWN:
// 해당 관할 지역에서 검증되지 않은 사용자 또는 연령 확인 정보를 사용할 수 없는 경우
// 사용자에게 Play 스토어를 방문하여 상태를 해결하도록 요청하세요.
HandleUnknownUser(result);
break;
}
}