Windows Client SDK API
- 1 Initialization and Status Change Event Processing
- 2 Login
- 3 Logout
- 4 Unregistration
- 5 Account Linking
- 6 Profile
- 7 System Information
- 7.1 Retrieve Language Code
- 7.2 Retrieve Language Tag
- 7.3 Retrieve Country Code
- 7.4 Retrieve IP-based Country Code
- 7.5 Retrieve Device ID
- 7.6 Retrieve Device Model
- 7.7 Retrieve OS Name
- 7.8 Retrieve Network Connection Status
- 7.9 Retrieve Connected Network Type
- 7.10 Get the Set Game Language Code
- 7.11 Set the Game Language Code
- 8 Kakao Integration Feature
- 8.1 Setting Up KakaoTalk Game Message Reception
- 8.2 Retrieve KakaoTalk Profile
- 8.3 Retrieve KakaoTalk Game Friend List
- 8.4 Sending KakaoTalk Game Messages
- 8.5 Adding a KakaoTalk Channel
- 8.6 Retrieve the list of friends to whom I sent an invite message
- 8.7 Retrieve the count of friends to whom I sent an invite message
Initialization and Status Change Event Processing
SDK Initialization
std::map<std::wstring, std::wstring> kakaoSetting, facebookSetting, googleSetting;
kakaoSetting.insert(std::pair<std::wstring, std::wstring>(TEXT("jsKey"), TEXT("acd84e5c92067a159573483d8877de67")));
facebookSetting.insert(std::pair<std::wstring, std::wstring>(TEXT("clientId"), TEXT("1421382574931990")));
googleSetting.insert(std::pair<std::wstring, std::wstring>(TEXT("clientId"), TEXT("1002041625464-s2ruvcn1auv3rksr799gb4matvtvppb5.apps.googleusercontent.com")));
googleSetting.insert(std::pair<std::wstring, std::wstring>(TEXT("clientSecret"), TEXT("5MtQUUZ1sHl7RYgrhee-7-22")));
std::map<KakaoGame::Data::KGTIdpCode, std::map<std::wstring, std::wstring>> idpSettings;
idpSettings.insert(std::pair<KakaoGame::Data::KGTIdpCode, std::map<std::wstring, std::wstring>>(KakaoGame::Data::KGTIdpCode::Kakao, kakaoSetting));
idpSettings.insert(std::pair<KakaoGame::Data::KGTIdpCode, std::map<std::wstring, std::wstring>>(KakaoGame::Data::KGTIdpCode::Facebook, facebookSetting));
idpSettings.insert(std::pair<KakaoGame::Data::KGTIdpCode, std::map<std::wstring, std::wstring>>(KakaoGame::Data::KGTIdpCode::Google, googleSetting));
/**
* For using a single app
*/
KakaoGame::Data::KGTConfig config;
config.setAppInfo(
TEXT("909428"), // appID
TEXT("c3c38bbfa3828b342d946e9770c974d0"), // appSecret
TEXT("1.0.0"), // appVersion
TEXT("gameWeb"), // market
TEXT("14"), // ageRating
KakaoGame::Data::KGTServerType::QA, // server type
KakaoGame::Data::KGTLogLevel::Error, // log level
idpSettings // idpSettings
);
/**
* For using an app group
*/
std::map<std::wstring, std::wstring> apps;
apps.insert(std::pair<std::wstring, std::wstring>(TEXT("909428"), TEXT("c3c38bbfa3828b342d946e9770c974d0")));
apps.insert(std::pair<std::wstring, std::wstring>(TEXT("921478"), TEXT("5891c32124ca35821890a0bc1cec77a5")));
apps.insert(std::pair<std::wstring, std::wstring>(TEXT("921482"), TEXT("43d0abf4ba4025994068607c545f04dc")));
apps.insert(std::pair<std::wstring, std::wstring>(TEXT("947947"), TEXT("3c7fde7309a1fad65961110e8e290e28")));
apps.insert(std::pair<std::wstring, std::wstring>(TEXT("947950"), TEXT("7cc67cba7e3406585543d493f1548473")));
config.setAppGroupInfos(
TEXT("tubeAppGroup"), // appGroupId
apps, // app info map
TEXT("1.0.0"), // appVersion
TEXT("gameWeb"), // market
TEXT("14"), // ageRating
KakaoGame::Data::KGTServerType::QA, // server type
KakaoGame::Data::KGTLogLevel::Error, // log level
idpSettings // idpSettings
);
KakaoGame::API::KGTApplication applicationApi;
applicationApi.initSDK(config);
Start
Synchronous Example
#include "KakaoGameLib.h"
KakaoGame::Data::KGTResult result;
KakaoGame::API::KGTApplication applicationApi;
applicationApi.start(GetSafeHwnd(), result);
if (result.isSuccess())
{
// If the start is successful
// Check if auto-login is enabled
KakaoGame::API::KGTPlayer playerApi;
boolean isLoggedIn = playerApi.isLoggedIn();
if (isLoggedIn)
{
// The current Player's ID issued by the platform
KakaoGame::Data::KGTPlayer player;
playerApi.getCurrentPlayer(player);
std::wstring playerId = player.playerId; // The current Player ID issued by the platform
std::wstring accessToken = playerApi.getAccessToken(); // Platform access token (AccessToken)
// [TODO] Move to the game screen
}
else
{
// [TODO] If auto-login is not enabled, move to the login screen
}
}
else
{
// If the start fails - since initialization failed, retry the start or close the app.
if (KakaoGame::Data::KGTResultCode::NetworkFailure == result.code
|| KakaoGame::Data::KGTResultCode::ServerTimeout == result.code
|| KakaoGame::Data::KGTResultCode::ConnectionFailed == result.code)
{
// [TODO] If a network error occurs, notify the user that the start failed due to a network issue and retry.
} else
{
// [TODO] If other errors occur, provide an error notification and request a retry of the start process. - If the issue persists, check the error code and logs to determine the cause.
}
}
Asynchronous Example
#include "KakaoGameLib.h"
KakaoGame::API::KGTApplication applicationApi;
applicationApi.start(GetSafeHwnd(), [this](KakaoGame::Data::KGTResult result) {
if (result.isSuccess())
{
// If the start is successful
// Check if auto-login is enabled
KakaoGame::API::KGTPlayer playerApi;
bool isLoggedIn = playerApi.isLoggedIn();
if (isLoggedIn)
{
// Get the current Player ID issued by the platform
KakaoGame::Data::KGTPlayer player;
playerApi.getCurrentPlayer(player);
std::wstring playerId = player.playerId; // The current Player ID issued by the platform
std::wstring accessToken = playerApi.getAccessToken(); // Platform access token (AccessToken)
// [TODO] Move to the game screen
}
else
{
// [TODO] If auto-login is not enabled, move to the login screen
}
}
else
{
// If the start fails - since initialization failed, retry the start or close the app.
if (KakaoGame::Data::KGTResultCode::NetworkFailure == result.code
|| KakaoGame::Data::KGTResultCode::ServerTimeout == result.code
|| KakaoGame::Data::KGTResultCode::ConnectionFailed == result.code)
{
// [TODO] If a network error occurs, notify the user that the start failed due to a network issue and retry.
}
else
{
// [TODO] If other errors occur, provide an error notification and request a retry of the start process. - If the issue persists, check the error code and logs to determine the cause.
}
}
});
Setting Up Auto Login in a Windows Environment
This feature is supported in the Windows environment.
If you do not use the default login UI provided by the SDK and instead implement your own login UI, the SDK offers a feature to set up auto login.
If you do not configure auto login, the SDK will not create a file for automatic login by default.
The file for auto login is created and stored in an encrypted format in the folder ".kakaogames" under the name ".access". This is because multiple users can exist on a single PC."
When a game is uninstalled and then reinstalled, if the auto login file remains, the SDK checks whether an encrypted ".access" file exists in the location of the Windows SDK file (KakaoGame.dll). If the file is valid, the SDK loads the file containing the auto login information and performs the auto login.
If the auto login files are corrupted, the SDK will delete them.
If the auto login file exists and the user logs out or withdraws, the auto login file will be deleted.
Login
Logging In Without Using the Default Login UI
Synchronous Example
Asynchronous Example
Logging in Using a Square Token
Synchronous Example
Asynchronous Example
Logout
Logging Out Without Using the Default Logout UI
Synchronous Example
Asynchronous Example
Unregistration
Unregistering Without Using the Default Unregistration UI
Synchronous Example
Asynchronous Example
Account Linking
Linking Accounts Without Using the Default Account Linking UI
Synchronous Example
Asynchronous Example
Profile
Retrieve My Information
Retrieve My IDP Information
System Information
Retrieve Language Code
Retrieve Language Tag
Retrieve Country Code
Retrieve IP-based Country Code
Retrieve Device ID
Retrieve Device Model
Retrieve OS Name
Retrieve Network Connection Status
Retrieve Connected Network Type
Get the Set Game Language Code
Returns the set game language code.
If no language code is set, it retrieves the language setting information configured on the device, and the language code is returned according to the ISO 639-1 standard.
Set the Game Language Code
Configures the game to use the language synchronized with the platform.
The following language codes are supported:
(Can be set before calling the Start API)
device: Device setting value. Can be used to revert to the device's setting value. (default)
en: English
ko: Korean
ja: Japanese
zh_hant: Chinese (Traditional)
zh_hans: Chinese (Simplified)
Kakao Integration Feature
Setting Up KakaoTalk Game Message Reception
Synchronous Example
Asynchronous Example
Retrieve KakaoTalk Profile
Synchronous Example
Asynchronous Example
Retrieve KakaoTalk Game Friend List
Synchronous Example
Asynchronous Example
Sending KakaoTalk Game Messages
Synchronous Example
Asynchronous Example
Adding a KakaoTalk Channel
Synchronous Example
Asynchronous Example
Retrieve the list of friends to whom I sent an invite message
Synchronous Example
Asynchronous Example
Retrieve the count of friends to whom I sent an invite message
Synchronous Example
Asynchronous Example