...
Initialization and Status Change Event Processing
...
SDK Initialization
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTApplication; import com.kakaogame.KGTConfig; /** * When using a single app */ KGTConfig config = new KGTConfig(); config.setAppInfo( "909428", // appID "c3c38bbfa3828b342d946e9770c974d0", // appSecret "1.0.0", // appVersion "googlePlay", // market "14", // ageRating KGTServerType.QA, // server type KGTLogLevel.Error // log level ); /** * When using an app group */ Map<String, String> appsForAppGroup = new HashMap<>(); appsForAppGroup.put("909428", "c3c38bbfa3828b342d946e9770c974d0"); appsForAppGroup.put("921478", "5891c32124ca35821890a0bc1cec77a5"); KGTConfig config = new KGTConfig(); config.setAppGroupInfos( "tubeAppGroup", // appGroupId appsForAppGroup, // app info map "1.0.0", // appVersion "googlePlay", // market "14", // ageRating KGTServerType.QA, // server type KGTLogLevel.Error // log level ); KGTApplication.initSDK(this, config); |
Start
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTApplication;
import com.kakaogame.KGTIdpProfile;
import com.kakaogame.KGTPlayer;
import com.kakaogame.KGTResult;
KGTApplication.start(activity, null, result -> {
if (result.isSuccess()) {
// If the start is successful
// Check if auto-login is enabled
boolean isLoggedIn = KGTPlayer.isLoggedIn();
if (isLoggedIn) {
// The current Player's ID issued by the platform
String playerId = KGTPlayer.getCurrentPlayer().getPlayerId();
// Platform access token (ZAT)
String accessToken = KGTPlayer.getCurrentPlayer().getAccessToken();
// Retrieve the current IDP authentication information
KGTIdpProfile idpProfile = KGTPlayer.getCurrentPlayer().getIdpProfile();
// [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, you should retry the start or close the app.
int resultCode = result.getCode();
if (resultCode == KGTResult.KGTResultCode.NETWORK_FAILURE
|| resultCode == KGTResult.KGTResultCode.SERVER_TIMEOUT
|| resultCode == KGTResult.KGTResultCode.SERVER_CONNECTION_FAILED) {
// [TODO] If a network error occurs, inform 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.
}
}
}); |
Pause
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTApplication; import com.kakaogame.KGTResult; KGTApplication.pause(activity, result -> { // }); |
Resume
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Adding a New Intent Receive Setting
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); // Update the current activity with the new intent this.setIntent(intent); } |
Login
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
Logging In Without Using the Default Login UI
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTApplication; import com.kakaogame.KGTIdpProfile; import com.kakaogame.KGTPlayer; import com.kakaogame.KGTResult; // Set the IdpCode for the login KGTIdpProfile.KGTIdpCode code = KGTIdpCode.Kakao; // Log in with a specific IDP KGTPlayer.login(activity, code, result -> { if (result.isSuccess()) { // IDP login and platform login succeeded // The current Player's ID issued by the platform String playerId = KGTPlayer.getCurrentPlayer().getPlayerId(); // Platform access token String accessToken = KGTPlayer.getAccessToken(); // Retrieve the current IDP authentication information KGTIdpProfile idpProfile = KGTPlayer.getCurrentPlayer().getIdpProfile(); // [TODO] Since login was successful, proceed to the game screen. } else { // IDP login or platform login failed // [TODO] If login fails, inform the user and prompt them to retry. if (result.getCode() == KGTResult.KGTResultCode.NETWORK_FAILURE || result.getCode() == KGTResult.KGTResultCode.SERVER_TIMEOUT || result.getCode() == KGTResult.KGTResultCode.SERVER_CONNECTION_FAILED) { // [TODO] If a network error occurs, prompt the user to retry logging in. } else if (result.getCode() == KGTResult.KGTResultCode.USER_CANCELED) { // [TODO] Since the user canceled during the login process, the login screen should be maintained. } else if (result.getCode() == KGTResult.KGTResultCode.BLOCKED_BY_POLICY) { // [TODO] The login was attempted from a blocked country code or IP range. Handle accordingly. } else { // [TODO] If other errors occur, provide an error notification and prompt the user to retry logging in. - It is necessary to check the error code and logs to determine the cause. } } }); |
Logout
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
Logging Out Without Using the Default Logout UI
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTPlayer; import com.kakaogame.KGTResult; // Unregister request KGTPlayer.unregister(activity, false, result -> { if (result.isSuccess()) { // Unregistration successful // [TODO] Return to the start screen } else { // Unregistration failed } }); |
Account Linking
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
Linking Accounts Without Using the Default Account Linking UI
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Retrieve My Information
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Retrieve My IDP Information
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Retrieve Language Code
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Retrieve Language Tag
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Retrieve Country Code
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Retrieve IP-based Country Code
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTSystem; String countryCode = KGTSystem.getGeoCountryCode(); |
Retrieve Device ID
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Retrieve Device Model
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTSystem; String deviceModel = KGTSystem.getDeviceModel(); |
Retrieve OS Name
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Retrieve Network Connection Status
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Retrieve Connected Network Type
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Setting Up KakaoTalk Game Message Reception
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Retrieve KakaoTalk Profile
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Retrieve KakaoTalk Game Friend List
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Sending KakaoTalk Game Messages
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Sending KakaoTalk Friend Invitation Messages
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Adding a KakaoTalk Channel
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...